Added a possibility to restrict the access to certain entity columns.

This commit is contained in:
Jan Böhmer 2019-03-20 19:11:34 +01:00
parent f31336bb87
commit 47fe76b22e
8 changed files with 271 additions and 1 deletions

View file

@ -34,6 +34,8 @@ use Doctrine\ORM\Mapping as ORM;
* must have the table row "id"!! The ID is the unique key to identify the elements.
*
* @ORM\MappedSuperclass()
*
* @ORM\EntityListeners({"App\Security\EntityListeners\ElementPermissionListener"})
*/
abstract class DBElement
{

View file

@ -34,6 +34,7 @@
namespace App\Entity;
use App\Security\Annotations\ColumnSecurity;
use Doctrine\ORM\Mapping as ORM;
//use Webmozart\Assert\Assert;
@ -109,6 +110,16 @@ class Part extends AttachmentContainingDBElement
/**
* @var string
* @ORM\Column(type="string")
*
* @ColumnSecurity(prefix="name")
*/
protected $name;
/**
* @var string
* @ORM\Column(type="string")
*
* @ColumnSecurity(prefix="description")
*/
protected $description = "";
@ -116,6 +127,8 @@ class Part extends AttachmentContainingDBElement
* @var int
* @ORM\Column(type="integer")
* @Assert\GreaterThanOrEqual(0)
*
* @ColumnSecurity(prefix="instock", type="integer")
*/
protected $instock = 0;
@ -123,12 +136,15 @@ class Part extends AttachmentContainingDBElement
* @var int
* @ORM\Column(type="integer")
* @Assert\GreaterThanOrEqual(0)
*
* @ColumnSecurity(prefix="mininstock", type="integer")
*/
protected $mininstock = 0;
/**
* @var string
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="comment")
*/
protected $comment = "";