From c92baf6cdaa84ec1e606f07fdd2a146e7f2bbd78 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Sun, 2 Jun 2024 23:02:27 +0000 Subject: [PATCH] - Removed NULL and added a new Enum instead --- src/Security/SecurityHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Security/SecurityHandler.php b/src/Security/SecurityHandler.php index 4b95969..5af6884 100644 --- a/src/Security/SecurityHandler.php +++ b/src/Security/SecurityHandler.php @@ -8,6 +8,7 @@ use Taxus\Taxus; use Psr\Http\Message\ResponseInterface; use Notes\ObjectResolver; +use Taxus\TaxusGrantEnum; class SecurityHandler { @@ -88,8 +89,10 @@ class SecurityHandler { protected function taxusGrantPermission(array $attributeList, object $user = null) : bool { foreach ($attributeList as $item) { - if (! isset($item->privilege) || $this->taxus->granted($item->privilege, $user, $item)) { - return true; + if ( $grant = $this->taxus->granted($item->privilege, $user, $item) ) { + if (is_bool($grant) ? $grant : $grant === TaxusGrantEnum::Authorized) { + return true; + } } }