mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
AdmissionLoader: Set additional user information assigned_roles
This commit is contained in:
parent
8ff88cd6f1
commit
9d10424f97
@ -179,9 +179,15 @@ class AdmissionLoader
|
||||
$roles = [];
|
||||
$permissions = [];
|
||||
$restrictions = [];
|
||||
$assignedRoles = [];
|
||||
$isUnrestricted = false;
|
||||
foreach ($this->roleConfig as $roleName => $roleConfig) {
|
||||
if (! isset($roles[$roleName]) && $this->match($username, $userGroups, $roleConfig)) {
|
||||
$assigned = $this->match($username, $userGroups, $roleConfig);
|
||||
if ($assigned) {
|
||||
$assignedRoles[] = $roleName;
|
||||
}
|
||||
|
||||
if (! isset($roles[$roleName]) && $assigned) {
|
||||
foreach ($this->loadRole($roleName, $roleConfig) as $role) {
|
||||
/** @var Role $role */
|
||||
$roles[$role->getName()] = $role;
|
||||
@ -206,6 +212,8 @@ class AdmissionLoader
|
||||
}
|
||||
}
|
||||
|
||||
$user->setAdditional('assigned_roles', $assignedRoles);
|
||||
|
||||
$user->setIsUnrestricted($isUnrestricted);
|
||||
$user->setRestrictions($isUnrestricted ? [] : $restrictions);
|
||||
$user->setPermissions($permissions);
|
||||
|
Loading…
x
Reference in New Issue
Block a user