User Permissions (User Folder, Read Only, Disable Upload) & more changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require 'config.php';
|
||||
require_once 'config.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Ensure user is authenticated
|
||||
@@ -23,6 +23,16 @@ if ($receivedToken !== $_SESSION['csrf_token']) {
|
||||
http_response_code(403);
|
||||
exit;
|
||||
}
|
||||
$userPermissions = loadUserPermissions($username);
|
||||
// Check if the user is read-only. (Assuming that if readOnly is true, deletion is disallowed.)
|
||||
$username = $_SESSION['username'] ?? '';
|
||||
if ($username) {
|
||||
$userPermissions = loadUserPermissions($username);
|
||||
if (isset($userPermissions['readOnly']) && $userPermissions['readOnly'] === true) {
|
||||
echo json_encode(["error" => "Read-only users are not allowed to create folders."]);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Get the JSON input and decode it
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
Reference in New Issue
Block a user