From 49015e5e89ed4791613b114b00ef248d5a5b9c93 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 6 Dec 2023 10:36:21 +0700 Subject: [PATCH] Update SecurityHandlerRole.php Added check for "ROLE_" - ignore attribute if one has "ROLE_" (cherry picked from commit 32711758381b31dc75999140995f24396af9860b) --- Admin/SecurityHandlerRole.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Admin/SecurityHandlerRole.php b/Admin/SecurityHandlerRole.php index 7d0ce4b..3c726cb 100644 --- a/Admin/SecurityHandlerRole.php +++ b/Admin/SecurityHandlerRole.php @@ -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 { @@ -125,4 +131,4 @@ public function createObjectSecurity(AdminInterface $admin, $object) */ public function deleteObjectSecurity(AdminInterface $admin, $object) {} -} \ No newline at end of file +}