mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 00:34:03 +02:00
AdmissionLoader: Optimize role loading
This commit is contained in:
parent
1a5cedfee1
commit
d9a87f76a2
@ -110,8 +110,8 @@ class AdmissionLoader
|
|||||||
protected function loadRole($name, ConfigObject $section)
|
protected function loadRole($name, ConfigObject $section)
|
||||||
{
|
{
|
||||||
if (! isset($this->roles[$name])) {
|
if (! isset($this->roles[$name])) {
|
||||||
$permissions = StringHelper::trimSplit($section->permissions);
|
$permissions = $section->permissions ? StringHelper::trimSplit($section->permissions) : [];
|
||||||
$refusals = StringHelper::trimSplit($section->refusals);
|
$refusals = $section->refusals ? StringHelper::trimSplit($section->refusals) : [];
|
||||||
|
|
||||||
list($permissions, $newRefusals) = self::migrateLegacyPermissions($permissions);
|
list($permissions, $newRefusals) = self::migrateLegacyPermissions($permissions);
|
||||||
if (! empty($newRefusals)) {
|
if (! empty($newRefusals)) {
|
||||||
@ -120,6 +120,7 @@ class AdmissionLoader
|
|||||||
|
|
||||||
$restrictions = $section->toArray();
|
$restrictions = $section->toArray();
|
||||||
unset($restrictions['users'], $restrictions['groups']);
|
unset($restrictions['users'], $restrictions['groups']);
|
||||||
|
unset($restrictions['parent'], $restrictions['unrestricted']);
|
||||||
unset($restrictions['refusals'], $restrictions['permissions']);
|
unset($restrictions['refusals'], $restrictions['permissions']);
|
||||||
|
|
||||||
$role = new Role();
|
$role = new Role();
|
||||||
@ -190,6 +191,10 @@ class AdmissionLoader
|
|||||||
if (! isset($roles[$roleName]) && $assigned) {
|
if (! isset($roles[$roleName]) && $assigned) {
|
||||||
foreach ($this->loadRole($roleName, $roleConfig) as $role) {
|
foreach ($this->loadRole($roleName, $roleConfig) as $role) {
|
||||||
/** @var Role $role */
|
/** @var Role $role */
|
||||||
|
if (isset($roles[$role->getName()])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$roles[$role->getName()] = $role;
|
$roles[$role->getName()] = $role;
|
||||||
|
|
||||||
$permissions = array_merge(
|
$permissions = array_merge(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user