mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 10:18:56 +02:00
Fix the $permissions must be initialized before access exception preventing login on two factor auth
This commit is contained in:
parent
fc27728c62
commit
75cf3dc46f
2 changed files with 11 additions and 3 deletions
|
@ -96,11 +96,11 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
protected $attachments;
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PermissionData
|
* @var PermissionData|null
|
||||||
* @ValidPermission()
|
* @ValidPermission()
|
||||||
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
||||||
*/
|
*/
|
||||||
protected PermissionData $permissions;
|
protected ?PermissionData $permissions = null;
|
||||||
|
|
||||||
/** @var Collection<int, GroupParameter>
|
/** @var Collection<int, GroupParameter>
|
||||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||||
|
@ -140,6 +140,10 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
|
|
||||||
public function getPermissions(): PermissionData
|
public function getPermissions(): PermissionData
|
||||||
{
|
{
|
||||||
|
if ($this->permissions === null) {
|
||||||
|
$this->permissions = new PermissionData();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->permissions;
|
return $this->permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
* @ValidPermission()
|
* @ValidPermission()
|
||||||
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
||||||
*/
|
*/
|
||||||
protected PermissionData $permissions;
|
protected ?PermissionData $permissions = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DateTime the time until the password reset token is valid
|
* @var DateTime the time until the password reset token is valid
|
||||||
|
@ -425,6 +425,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
public function getPermissions(): PermissionData
|
public function getPermissions(): PermissionData
|
||||||
{
|
{
|
||||||
|
if ($this->permissions === null) {
|
||||||
|
$this->permissions = new PermissionData();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->permissions;
|
return $this->permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue