From 97d43c92e6feb7a16e279e3b91f5bcc24283c956 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 24 Feb 2020 18:19:04 +0100 Subject: [permissionmanager] Properly reset builtin roles on upgrade --- modules-available/permissionmanager/install.inc.php | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v1.2.3-55-g7522