instances added god may help
This commit is contained in:
@@ -19,13 +19,16 @@ function can(string $permissionKey): bool
|
||||
if ($userId <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (!class_exists('MintyPHP\\Service\\Access\\PermissionService')) {
|
||||
if (!function_exists('permissionGateway')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$permissionGateway = permissionGateway();
|
||||
|
||||
// First try the in-memory/session cache, then fall back to a direct fetch.
|
||||
$keys = \MintyPHP\Service\Access\PermissionService::getCachedPermissions($userId);
|
||||
$keys = $permissionGateway->getCachedPermissions($userId);
|
||||
if (!$keys) {
|
||||
$keys = \MintyPHP\Service\Access\PermissionService::getUserPermissions($userId);
|
||||
$keys = $permissionGateway->getUserPermissions($userId);
|
||||
if (!$keys) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user