Custom Roles & Permissions

Initial enforcement of custom roles & permissions - only on some pages via GET for now.
This commit is contained in:
wrongecho
2024-09-20 17:59:49 +01:00
parent 1390ca07f9
commit 10fafacefe
43 changed files with 469 additions and 345 deletions

View File

@@ -1322,7 +1322,11 @@ function enforceUserPermission($module, $check_access_level = 1) {
if (!$permitted_access_level || $permitted_access_level < $check_access_level) {
$_SESSION['alert_type'] = "danger";
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
header("Location: " . $_SERVER["HTTP_REFERER"]);
exit(WORDING_ROLECHECK_FAILED);
$map = [
"1" => "read",
"2" => "write",
"3" => "full"
];
exit(WORDING_ROLECHECK_FAILED . "<br>Tell your admin: $map[$check_access_level] access to $module is not permitted for your role.");
}
}