diff options
author | Simon Rettberg | 2018-02-20 15:20:26 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-02-20 15:20:26 +0100 |
commit | 7dc7a49e3704b52c4a40909050bf831826b3c41b (patch) | |
tree | 994ee137b0c11acfab798793b53dd953b81cdc91 /modules-available/permissionmanager/inc/permissionutil.inc.php | |
parent | [permissionmanager] Fix location table display (diff) | |
download | slx-admin-7dc7a49e3704b52c4a40909050bf831826b3c41b.tar.gz slx-admin-7dc7a49e3704b52c4a40909050bf831826b3c41b.tar.xz slx-admin-7dc7a49e3704b52c4a40909050bf831826b3c41b.zip |
[permissionmanager] Ensure uniqueness in role_x_location table, consistent table naming, drop unused id field
Diffstat (limited to 'modules-available/permissionmanager/inc/permissionutil.inc.php')
-rw-r--r-- | modules-available/permissionmanager/inc/permissionutil.inc.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules-available/permissionmanager/inc/permissionutil.inc.php b/modules-available/permissionmanager/inc/permissionutil.inc.php index bc42c5a0..29663ed9 100644 --- a/modules-available/permissionmanager/inc/permissionutil.inc.php +++ b/modules-available/permissionmanager/inc/permissionutil.inc.php @@ -60,8 +60,8 @@ class PermissionUtil $prefix = $parts[0] . '.%'; if (is_null($locationid)) { $res = Database::simpleQuery("SELECT permissionid FROM role_x_permission - INNER JOIN user_x_role USING (roleid) - WHERE user_x_role.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*')", + INNER JOIN role_x_user USING (roleid) + WHERE role_x_user.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*')", compact('userid', 'prefix')); } else { if ($locationid === 0) { @@ -73,9 +73,9 @@ class PermissionUtil } } $res = Database::simpleQuery("SELECT permissionid FROM role_x_permission - INNER JOIN user_x_role USING (roleid) + INNER JOIN role_x_user USING (roleid) INNER JOIN role_x_location USING (roleid) - WHERE user_x_role.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*') + WHERE role_x_user.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*') AND (locationid IN (:locations) OR locationid IS NULL)", compact('userid', 'prefix', 'locations')); } @@ -113,9 +113,9 @@ class PermissionUtil // Limit query to first part of permissionid, which is always the module id $prefix = $parts[0] . '.%'; $res = Database::simpleQuery("SELECT permissionid, locationid FROM role_x_permission - INNER JOIN user_x_role USING (roleid) + INNER JOIN role_x_user USING (roleid) INNER JOIN role_x_location USING (roleid) - WHERE user_x_role.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*')", + WHERE role_x_user.userid = :userid AND (permissionid LIKE :prefix OR permissionid LIKE '*')", compact('userid', 'prefix')); // Gather locationid from relevant rows |