summaryrefslogtreecommitdiffstats
path: root/modules-available/permissionmanager
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-21 11:09:17 +0100
committerSimon Rettberg2019-02-21 11:09:17 +0100
commit67c915aa7094a32b0dfdd4ef60382bb1d3eeb506 (patch)
tree89e1222a4bd6ed6076e739e151b3af5a80c4aff8 /modules-available/permissionmanager
parentAAAAAnd I'm retarded (diff)
downloadslx-admin-67c915aa7094a32b0dfdd4ef60382bb1d3eeb506.tar.gz
slx-admin-67c915aa7094a32b0dfdd4ef60382bb1d3eeb506.tar.xz
slx-admin-67c915aa7094a32b0dfdd4ef60382bb1d3eeb506.zip
Fix UUID handling; refactor constraints for machineuuid
Diffstat (limited to 'modules-available/permissionmanager')
-rw-r--r--modules-available/permissionmanager/install.inc.php30
1 files changed, 10 insertions, 20 deletions
diff --git a/modules-available/permissionmanager/install.inc.php b/modules-available/permissionmanager/install.inc.php
index 7f9c80ef..d0f8cdeb 100644
--- a/modules-available/permissionmanager/install.inc.php
+++ b/modules-available/permissionmanager/install.inc.php
@@ -51,50 +51,40 @@ if (tableHasColumn('role_x_location', 'id')) {
if (!tableExists('user') || !tableExists('location')) {
finalResponse(UPDATE_RETRY, 'Cannot add constraint yet. Please retry.');
} else {
- $c = tableGetContraints('role_x_user', 'userid', 'user', 'userid');
- if ($c === false)
- finalResponse(UPDATE_FAILED, 'Cannot get constraints of user table: ' . Database::lastError());
- if (empty($c)) {
+ $c = tableGetConstraints('role_x_user', 'userid', 'user', 'userid');
+ if ($c === false) {
$alter = Database::exec('ALTER TABLE role_x_user ADD FOREIGN KEY (userid) REFERENCES user (userid) ON DELETE CASCADE ON UPDATE CASCADE');
if ($alter === false)
finalResponse(UPDATE_FAILED, 'Cannot add userid constraint referencing user table: ' . Database::lastError());
$res[] = UPDATE_DONE;
}
- $c = tableGetContraints('role_x_user', 'roleid', 'role', 'roleid');
- if ($c === false)
- finalResponse(UPDATE_FAILED, 'Cannot get constraints of role table: ' . Database::lastError());
- if (empty($c)) {
+ $c = tableGetConstraints('role_x_user', 'roleid', 'role', 'roleid');
+ if ($c === false) {
$alter = Database::exec('ALTER TABLE role_x_user ADD FOREIGN KEY (roleid) REFERENCES role (roleid) ON DELETE CASCADE ON UPDATE CASCADE');
if ($alter === false)
finalResponse(UPDATE_FAILED, 'Cannot add roleid constraint referencing role table: ' . Database::lastError());
$res[] = UPDATE_DONE;
}
- $c = tableGetContraints('role_x_location', 'roleid', 'role', 'roleid');
- if ($c === false)
- finalResponse(UPDATE_FAILED, 'Cannot get constraints of role table: ' . Database::lastError());
- if (empty($c)) {
+ $c = tableGetConstraints('role_x_location', 'roleid', 'role', 'roleid');
+ if ($c === false) {
$alter = Database::exec('ALTER TABLE role_x_location ADD FOREIGN KEY (roleid) REFERENCES role (roleid) ON DELETE CASCADE ON UPDATE CASCADE');
if ($alter === false)
finalResponse(UPDATE_FAILED, 'Cannot add roleid constraint referencing role table: ' . Database::lastError());
$res[] = UPDATE_DONE;
}
- $c = tableGetContraints('role_x_location', 'locationid', 'location', 'locationid');
- if ($c === false)
- finalResponse(UPDATE_FAILED, 'Cannot get constraints of location table: ' . Database::lastError());
- if (empty($c)) {
+ $c = tableGetConstraints('role_x_location', 'locationid', 'location', 'locationid');
+ if ($c === false) {
$alter = Database::exec('ALTER TABLE role_x_location ADD FOREIGN KEY (locationid) REFERENCES location (locationid) ON DELETE CASCADE ON UPDATE CASCADE');
if ($alter === false)
finalResponse(UPDATE_FAILED, 'Cannot add locationid constraint referencing location table: ' . Database::lastError());
$res[] = UPDATE_DONE;
}
- $c = tableGetContraints('role_x_permission', 'roleid', 'role', 'roleid');
- if ($c === false)
- finalResponse(UPDATE_FAILED, 'Cannot get constraints of role table: ' . Database::lastError());
- if (empty($c)) {
+ $c = tableGetConstraints('role_x_permission', 'roleid', 'role', 'roleid');
+ if ($c === false) {
$alter = Database::exec('ALTER TABLE role_x_permission ADD FOREIGN KEY (roleid) REFERENCES role (roleid) ON DELETE CASCADE ON UPDATE CASCADE');
if ($alter === false)
finalResponse(UPDATE_FAILED, 'Cannot add roleid constraint referencing role table: ' . Database::lastError());