diff --git a/src/Security/Permission.php b/src/Security/Permission.php index a646b81e..7e0e74aa 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -597,20 +597,17 @@ public function isAllowed($role = self::ALL, $resource = self::ALL, $privilege = break; } } - } else { - if (($result = $this->getRuleType($resource, null, $privilege)) !== null) { // look for rule on 'allRoles' pseudo-parent - break; - - } elseif (($result = $this->getRuleType($resource, null, null)) !== null) { - break; - } + } elseif (($result = $this->getRuleType($resource, null, $privilege)) !== null) { // look for rule on 'allRoles' pseudo-parent + break; + } elseif (($result = $this->getRuleType($resource, null, null)) !== null) { + break; } $resource = $this->resources[$resource]['parent']; // try next Resource } while (true); $this->queriedRole = $this->queriedResource = null; - return $result; + return $result ?? false; }