-
-
-
+
+
Module permissions do not apply to Admins.
@@ -123,22 +129,73 @@ ob_start();
?>
+
diff --git a/admin/post/roles.php b/admin/post/roles.php
index a0ec99d2..d38e0a65 100644
--- a/admin/post/roles.php
+++ b/admin/post/roles.php
@@ -18,9 +18,23 @@ if (isset($_POST['add_role'])) {
$role_id = mysqli_insert_id($mysqli);
+ // Insert role permissions (only if not admin)
+ if ($admin == 0) {
+ foreach ($_POST as $key => $value) {
+ if (str_contains($key, '##module_')) {
+ $module_id = intval(explode('##', $key)[0]);
+ $access_level = intval($value);
+
+ if ($access_level > 0) {
+ mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = $role_id, module_id = $module_id, user_role_permission_level = $access_level");
+ }
+ }
+ }
+ }
+
logAction("User Role", "Create", "$session_name created user role $name", 0, $role_id);
- flash_alert("User Role
created");
+ flash_alert("User Role $name created");
redirect();