Added a simple Voter for checking, if a user is allowed, to view/edit/create a part.

This commit is contained in:
Jan Böhmer 2019-03-18 19:05:41 +01:00
parent ab3f5db174
commit 01e1f27b68
10 changed files with 750 additions and 4 deletions

View file

@ -31,6 +31,7 @@
namespace App\Entity;
use App\Security\Interfaces\HasPermissionsInterface;
use Doctrine\ORM\Mapping as ORM;
/**
@ -40,7 +41,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Entity()
* @ORM\Table("groups")
*/
class Group extends StructuralDBElement
class Group extends StructuralDBElement implements HasPermissionsInterface
{
/**
@ -59,6 +60,11 @@ class Group extends StructuralDBElement
*/
protected $users;
/** @var PermissionsEmbed
* @ORM\Embedded(class="PermissionsEmbed", columnPrefix="perms_")
*/
protected $permissions;
/**
* Returns the ID as an string, defined by the element class.
@ -69,4 +75,9 @@ class Group extends StructuralDBElement
{
return 'G' . sprintf('%06d', $this->getID());
}
public function getPermissions(): PermissionsEmbed
{
return $this->permissions;
}
}