major update

This commit is contained in:
2026-03-04 15:56:58 +01:00
parent 16759a2732
commit 8f4dd5840d
478 changed files with 24313 additions and 8201 deletions

View File

@@ -9,29 +9,3 @@ function accountUrl(): string
$uuid = (string) ($user['uuid'] ?? '');
return $uuid !== '' ? lurl('profile') : lurl('login');
}
/**
* Check if the current user has a permission key.
*/
function can(string $permissionKey): bool
{
$userId = (int) ($_SESSION['user']['id'] ?? 0);
if ($userId <= 0) {
return false;
}
if (!function_exists('permissionGateway')) {
return false;
}
$permissionGateway = permissionGateway();
// First try the in-memory/session cache, then fall back to a direct fetch.
$keys = $permissionGateway->getCachedPermissions($userId);
if (!$keys) {
$keys = $permissionGateway->getUserPermissions($userId);
if (!$keys) {
return false;
}
}
return in_array($permissionKey, $keys, true);
}