instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -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;
}