loadUserPermissions cleanup
This commit is contained in:
15
config.php
15
config.php
@@ -55,7 +55,7 @@ if (!$encryptionKey) {
|
|||||||
|
|
||||||
function loadUserPermissions($username)
|
function loadUserPermissions($username)
|
||||||
{
|
{
|
||||||
global $encryptionKey; // Ensure $encryptionKey is available
|
global $encryptionKey;
|
||||||
$permissionsFile = USERS_DIR . 'userPermissions.json';
|
$permissionsFile = USERS_DIR . 'userPermissions.json';
|
||||||
|
|
||||||
if (file_exists($permissionsFile)) {
|
if (file_exists($permissionsFile)) {
|
||||||
@@ -69,21 +69,12 @@ function loadUserPermissions($username)
|
|||||||
$permissions = json_decode($content, true);
|
$permissions = json_decode($content, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($permissions)) {
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($permissions) && array_key_exists($username, $permissions)) {
|
if (is_array($permissions) && array_key_exists($username, $permissions)) {
|
||||||
$result = $permissions[$username];
|
$result = $permissions[$username];
|
||||||
if (empty($result)) {
|
return !empty($result) ? $result : false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
error_log("loadUserPermissions: Permissions file not found: $permissionsFile");
|
|
||||||
}
|
}
|
||||||
|
// Removed error_log() to prevent flooding logs when file is not found.
|
||||||
return false; // Return false if no permissions found.
|
return false; // Return false if no permissions found.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user