- Removed NULL and added a new Enum instead
This commit is contained in:
parent
86afea9b4e
commit
c92baf6cda
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue