mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Save permissions as JSON in user/group entities.
This commit is contained in:
parent
33f8d2ba9e
commit
687ee80255
9 changed files with 316 additions and 40 deletions
|
@ -265,11 +265,17 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
protected $currency;
|
||||
|
||||
/**
|
||||
* @var PermissionData
|
||||
* @ORM\Column(type="permission_data", nullable=false, name="permissions")
|
||||
*/
|
||||
protected PermissionData $permissions;
|
||||
|
||||
/** @var PermissionsEmbed
|
||||
* @ORM\Embedded(class="PermissionsEmbed", columnPrefix="perms_")
|
||||
* @ValidPermission()
|
||||
*/
|
||||
protected $permissions;
|
||||
protected $permissions_old;
|
||||
|
||||
/**
|
||||
* @var DateTime the time until the password reset token is valid
|
||||
|
@ -280,7 +286,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->permissions = new PermissionsEmbed();
|
||||
$this->permissions = new PermissionData();
|
||||
$this->u2fKeys = new ArrayCollection();
|
||||
$this->webauthn_keys = new ArrayCollection();
|
||||
}
|
||||
|
@ -427,8 +433,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getPermissions(): PermissionsEmbed
|
||||
public function getPermissions(): PermissionData
|
||||
{
|
||||
if (!isset($this->permissions)) {
|
||||
$this->permissions = new PermissionData();
|
||||
}
|
||||
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue