Skip to content

Commit

Permalink
fix generation of role mig when there are policy limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Nov 21, 2022
1 parent 0ab449a commit 14ad21b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Core/Executor/RoleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand All @@ -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);
}
}

0 comments on commit 14ad21b

Please sign in to comment.