summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-02-24 18:19:04 +0100
committerSimon Rettberg2020-02-24 18:19:04 +0100
commit97d43c92e6feb7a16e279e3b91f5bcc24283c956 (patch)
treeceebe57ef66bc9524e7965f1e0220e988dad4d71
parent[backup] Increase sleep before reboot (diff)
downloadslx-admin-97d43c92e6feb7a16e279e3b91f5bcc24283c956.tar.gz
slx-admin-97d43c92e6feb7a16e279e3b91f5bcc24283c956.tar.xz
slx-admin-97d43c92e6feb7a16e279e3b91f5bcc24283c956.zip
[permissionmanager] Properly reset builtin roles on upgrade
-rw-r--r--modules-available/permissionmanager/install.inc.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules-available/permissionmanager/install.inc.php b/modules-available/permissionmanager/install.inc.php
index 5d1f60da..9ff5a2d4 100644
--- a/modules-available/permissionmanager/install.inc.php
+++ b/modules-available/permissionmanager/install.inc.php
@@ -120,6 +120,8 @@ if (Database::exec("INSERT INTO `role` (roleid, rolename, builtin, roledescripti
// Assign roles to location (all)
Database::exec("DELETE FROM role_x_location WHERE roleid IN (1,2,3,4)");
Database::exec("INSERT INTO `role_x_location` VALUES (1,NULL),(2,NULL),(3,NULL),(4,NULL)");
+ // In case user fiddled around before
+ Database::exec("DELETE FROM role_x_permission WHERE roleid IN (1,2,3,4)");
// Assign permissions to roles
Database::exec("INSERT IGNORE INTO `role_x_permission` VALUES
(3,'exams.exams.*'),
@@ -195,6 +197,7 @@ if (Database::exec("INSERT INTO `role` (roleid, rolename, builtin, roledescripti
(2,'systemstatus.*'),
(2,'vmstore.edit'),
(2,'webinterface.*')");
+ Database::exec("OPTIMIZE TABLE role_x_permission");
// Assign the first user to the superadmin role (if one exists)
Database::exec("INSERT IGNORE INTO `role_x_user` VALUES (1,1)");
$res[] = UPDATE_DONE;