Skip to content

Commit

Permalink
Update SecurityHandlerRole.php
Browse files Browse the repository at this point in the history
Added check for "ROLE_" - ignore attribute if one has "ROLE_"

(cherry picked from commit 3271175)
  • Loading branch information
nilov committed Dec 6, 2023
1 parent 8870153 commit 49015e5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Admin/SecurityHandlerRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ public function isGranted(AdminInterface $admin, $attributes, $object = null)
}

foreach ($attributes as $pos => $attribute) {
$attribute = strtoupper($attribute);
$attribute = isset($this->roleReplaces[$attribute]) ? $this->roleReplaces[$attribute] : $attribute;
$attributes[$pos] = sprintf($this->getBaseRole($admin), $attribute);

if (strpos($attribute, 'ROLE_') !== 0) {
$attribute = sprintf($this->getBaseRole($admin), $attribute);
}

$attributes[$pos] = $attribute;
}

try {
Expand Down Expand Up @@ -125,4 +131,4 @@ public function createObjectSecurity(AdminInterface $admin, $object)
*/
public function deleteObjectSecurity(AdminInterface $admin, $object)
{}
}
}

0 comments on commit 49015e5

Please sign in to comment.