Fix the $permissions must be initialized before access exception preventing login on two factor auth

This commit is contained in:
Jan Böhmer 2022-11-28 00:03:42 +01:00
parent fc27728c62
commit 75cf3dc46f
2 changed files with 11 additions and 3 deletions

View file

@ -265,7 +265,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @ValidPermission()
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
*/
protected PermissionData $permissions;
protected ?PermissionData $permissions = null;
/**
* @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
{
if ($this->permissions === null) {
$this->permissions = new PermissionData();
}
return $this->permissions;
}