diff options
author | Simon Rettberg | 2022-07-06 15:57:11 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-07-06 15:57:11 +0200 |
commit | 03ff1fd26ac6efca7b94ddadc2208bb43bd3ab85 (patch) | |
tree | 32683e70e0d7b81f8c59bb929dae960f37a87013 /modules-available/permissionmanager/install.inc.php | |
parent | install.php: Fix charset upgrade statement (diff) | |
download | slx-admin-03ff1fd26ac6efca7b94ddadc2208bb43bd3ab85.tar.gz slx-admin-03ff1fd26ac6efca7b94ddadc2208bb43bd3ab85.tar.xz slx-admin-03ff1fd26ac6efca7b94ddadc2208bb43bd3ab85.zip |
[permissionmanager] Shorten permissionid to 100 chars
Upgrading to utf8mb4 fails on older InnoDB setups with a key length
limited to 768 bytes. While we could/should probably upgrade these some
time, limit the column length for now, as even 100 characters is
excessive for a permission id.
Diffstat (limited to 'modules-available/permissionmanager/install.inc.php')
-rw-r--r-- | modules-available/permissionmanager/install.inc.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules-available/permissionmanager/install.inc.php b/modules-available/permissionmanager/install.inc.php index 9e26613d..d0e0a016 100644 --- a/modules-available/permissionmanager/install.inc.php +++ b/modules-available/permissionmanager/install.inc.php @@ -31,7 +31,7 @@ $res[] = tableCreate('role_x_location', " $res[] = tableCreate('role_x_permission', " roleid int(10) unsigned NOT NULL, - permissionid varchar(200) NOT NULL, + permissionid varchar(100) NOT NULL, PRIMARY KEY (roleid, permissionid) "); @@ -109,6 +109,14 @@ if (!tableHasColumn('role', 'builtin')) { $res[] = UPDATE_DONE; } +// 2022-07-06 permissionid too long for older mariadb versions +if (tableColumnType('role_x_permission', 'permissionid') === 'varchar(200)') { + $alter = Database::exec("ALTER TABLE role_x_permission MODIFY permissionid varchar(100) NOT NULL"); + if ($alter === false) + finalResponse(UPDATE_FAILED, 'Cannot shorten permissionid to 100: ' . Database::lastError()); + $res[] = UPDATE_DONE; +} + if (Database::exec("INSERT INTO `role` (roleid, rolename, builtin, roledescription) VALUES (1,'Super-Admin', 1, 'Hat keinerlei Zugriffsbeschränkungen'), (2,'Admin', 1, 'Alles bis auf Rechte-/Nutzerverwaltung'), |