mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 04:30:08 +02:00
Added a simple Voter for checking, if a user is allowed, to view/edit/create a part.
This commit is contained in:
parent
ab3f5db174
commit
01e1f27b68
10 changed files with 750 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue