- Removed NULL and added a new Enum instead

This commit is contained in:
Dave Mc Nicoll 2024-06-02 23:02:27 +00:00
parent 86afea9b4e
commit c92baf6cda
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ use Taxus\Taxus;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Notes\ObjectResolver; use Notes\ObjectResolver;
use Taxus\TaxusGrantEnum;
class SecurityHandler { class SecurityHandler {
@ -88,8 +89,10 @@ class SecurityHandler {
protected function taxusGrantPermission(array $attributeList, object $user = null) : bool protected function taxusGrantPermission(array $attributeList, object $user = null) : bool
{ {
foreach ($attributeList as $item) { foreach ($attributeList as $item) {
if (! isset($item->privilege) || $this->taxus->granted($item->privilege, $user, $item)) { if ( $grant = $this->taxus->granted($item->privilege, $user, $item) ) {
return true; if (is_bool($grant) ? $grant : $grant === TaxusGrantEnum::Authorized) {
return true;
}
} }
} }