User: Add property `$unrestricted`

This commit is contained in:
Johannes Meyer 2021-03-09 11:27:13 +01:00
parent 8c147c1b2f
commit 5dfa5e28da
2 changed files with 32 additions and 0 deletions

View File

@ -206,6 +206,7 @@ class AdmissionLoader
}
}
$user->setIsUnrestricted($isUnrestricted);
$user->setRestrictions($isUnrestricted ? [] : $restrictions);
$user->setPermissions($permissions);
$user->setRoles(array_values($roles));

View File

@ -73,6 +73,13 @@ class User
*/
protected $externalUserInformation = array();
/**
* Whether restrictions should not apply to this user
*
* @var bool
*/
protected $unrestricted = false;
/**
* Set of permissions
*
@ -202,6 +209,30 @@ class User
return in_array($group, $this->groups);
}
/**
* Get whether restrictions should not apply to this user
*
* @return bool
*/
public function isUnrestricted()
{
return $this->unrestricted;
}
/**
* Set whether restrictions should not apply to this user
*
* @param bool $state
*
* @return $this
*/
public function setIsUnrestricted($state)
{
$this->unrestricted = (bool) $state;
return $this;
}
/**
* Get the user's permissions
*