From 14ad21b7ee2354005360b94f097a1095c03c5a4f Mon Sep 17 00:00:00 2001 From: gggeek Date: Mon, 21 Nov 2022 16:48:41 +0000 Subject: [PATCH] fix generation of role mig when there are policy limitations --- Core/Executor/RoleManager.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/Executor/RoleManager.php b/Core/Executor/RoleManager.php index bdeb955..98097eb 100644 --- a/Core/Executor/RoleManager.php +++ b/Core/Executor/RoleManager.php @@ -487,16 +487,15 @@ protected function sortPolicyDefinitions(array &$policies) return $fComp; } // ugly: sort by comparing limitations identifiers - return $this->compareArraysForSorting($p1['limitations'], $p2['limitations']); + /// @todo if limitations identifiers are the same, sort by lim. values... $p1LimIds = array(); $p2LimIds = array(); foreach ($p1['limitations'] as $lim) { - $p1LimIds = $lim['identifier']; + $p1LimIds[] = $lim['identifier']; } foreach ($p2['limitations'] as $lim) { - $p2LimIds = $lim['identifier']; + $p2LimIds[] = $lim['identifier']; } - /// @todo if limitations identifier are the same, sort by lim. values... return $this->compareArraysForSorting($p1LimIds, $p2LimIds); }); } @@ -516,7 +515,7 @@ protected function compareArraysForSorting($a1, $a2) return $cmp; } } - // the array with less elements wins + // the array with fewer elements wins return count($a1) - count($a2); } }