summaryrefslogtreecommitdiffstats
path: root/modules-available/main
diff options
context:
space:
mode:
authorSimon Rettberg2018-03-19 11:45:35 +0100
committerSimon Rettberg2018-03-19 11:45:35 +0100
commit3beca9753a41a4a8627770d83c512b7dc32178e7 (patch)
tree937dac70bfb35198dd78452d59e11ff6bd1d1595 /modules-available/main
parent[sysconfig] Support new multiserver auth, mount option config support (diff)
downloadslx-admin-3beca9753a41a4a8627770d83c512b7dc32178e7.tar.gz
slx-admin-3beca9753a41a4a8627770d83c512b7dc32178e7.tar.xz
slx-admin-3beca9753a41a4a8627770d83c512b7dc32178e7.zip
[main] install: Make sure a user with userid 1 exists
Diffstat (limited to 'modules-available/main')
-rw-r--r--modules-available/main/install.inc.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php
index e364a905..ec8554fd 100644
--- a/modules-available/main/install.inc.php
+++ b/modules-available/main/install.inc.php
@@ -43,6 +43,7 @@ $res[] = tableCreate('user', "
`email` varchar(100) DEFAULT NULL,
`permissions` int(10) unsigned NOT NULL,
`lasteventid` int(10) unsigned NOT NULL DEFAULT '0',
+ `serverid` int(10) unsigned NULL DEFAULT NULL,
PRIMARY KEY (`userid`),
UNIQUE KEY `login` (`login`)
");
@@ -72,6 +73,20 @@ if (!tableHasColumn('callback', 'args')) {
Database::exec("ALTER TABLE `callback` ADD `args` TEXT NOT NULL DEFAULT ''");
}
+// #######################
+// ##### 2018-03-19
+// In preparation for LDAP/AD auth: Column to rembember origin server
+if (!tableHasColumn('user', 'serverid')) {
+ Database::exec("ALTER TABLE `user` ADD `serverid` int(10) unsigned NULL DEFAULT NULL");
+}
+
+// Make sure that if any users exist, one of the has UID=1, otherwise if the permission module is
+// used we'd lock out everyone
+$someUser = Database::queryFirst('SELECT userid FROM user ORDER BY userid ASC LIMIT 1');
+if ($someUser !== false && (int)$someUser['userid'] !== 1) {
+ Database::exec('UPDATE user SET userid = 1 WHERE userid = :oldid', ['oldid' => $someUser['userid']]);
+}
+
// Create response for browser
if (in_array(UPDATE_DONE, $res)) {