Skip to content

Commit

Permalink
fix: Make sure super role contains admin:* permission
Browse files Browse the repository at this point in the history
This wasn't necessarily the case when the role was imported after a
reset of the database.
  • Loading branch information
marien-probesys committed Sep 11, 2024
1 parent 3903511 commit e7bf8ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Entity/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public static function sanitizePermissions(string $type, array $permissions): ar
// We use array_values to reindex the returned array.
$permissions = array_values($permissions);

if ($type === 'admin' && !in_array('admin:see', $permissions)) {
if ($type === 'super' && !in_array('admin:*', $permissions)) {
$permissions[] = 'admin:*';
} elseif ($type === 'admin' && !in_array('admin:see', $permissions)) {
$permissions[] = 'admin:see';
} elseif ($type === 'agent' && !in_array('orga:see', $permissions)) {
$permissions[] = 'orga:see';
Expand Down

0 comments on commit e7bf8ac

Please sign in to comment.