Allow to restrict the file extensions for a attachment type.

This commit is contained in:
Jan Böhmer 2019-10-31 22:37:54 +01:00
parent 2187f5eac2
commit fdfb099cb5
25 changed files with 714 additions and 4 deletions

View file

@ -56,6 +56,7 @@ use App\Entity\Base\StructuralDBElement;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Validator\Constraints\ValidFileFilter;
/**
* Class AttachmentType.
@ -91,6 +92,7 @@ class AttachmentType extends StructuralDBElement
/**
* @var string
* @ORM\Column(type="text")
* @ValidFileFilter
*/
protected $filetype_filter = "";
@ -112,6 +114,8 @@ class AttachmentType extends StructuralDBElement
/**
* Gets an filter, which file types are allowed for attachment files.
* Must be in the format of <input type=file> accept attribute
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
* @return string
*/
public function getFiletypeFilter(): string
@ -129,8 +133,6 @@ class AttachmentType extends StructuralDBElement
return $this;
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.