diff options
author | Udo Walter | 2017-11-21 17:24:44 +0100 |
---|---|---|
committer | Udo Walter | 2017-11-21 17:24:44 +0100 |
commit | 3d88bb5a4223d3fdc9084eee3e75defc8da674b0 (patch) | |
tree | 9d15a1ccafa5ec3ee97f991637145e524e70e37c /modules-available/permissionmanager/inc/permissionutil.inc.php | |
parent | [dozmod] implemented new permission system to module for: deleting expired vm... (diff) | |
download | slx-admin-3d88bb5a4223d3fdc9084eee3e75defc8da674b0.tar.gz slx-admin-3d88bb5a4223d3fdc9084eee3e75defc8da674b0.tar.xz slx-admin-3d88bb5a4223d3fdc9084eee3e75defc8da674b0.zip |
[permissionmanager] added key relationships to install script;
changed nested php for loops to sql code; standardized sql column naming;
small bugfixes;
Diffstat (limited to 'modules-available/permissionmanager/inc/permissionutil.inc.php')
-rw-r--r-- | modules-available/permissionmanager/inc/permissionutil.inc.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules-available/permissionmanager/inc/permissionutil.inc.php b/modules-available/permissionmanager/inc/permissionutil.inc.php index 5c3eef58..17257eec 100644 --- a/modules-available/permissionmanager/inc/permissionutil.inc.php +++ b/modules-available/permissionmanager/inc/permissionutil.inc.php @@ -11,7 +11,7 @@ class PermissionUtil } $res = Database::simpleQuery("SELECT role_x_permission.permissionid as 'permissionid', - role_x_location.locid as 'locationid' + role_x_location.locationid as 'locationid' FROM user_x_role INNER JOIN role_x_permission ON user_x_role.roleid = role_x_permission.roleid LEFT JOIN role_x_location ON role_x_permission.roleid = role_x_location.roleid @@ -29,11 +29,11 @@ class PermissionUtil public static function getAllowedLocations($userid, $permissionid) { - $res = Database::simpleQuery("SELECT role_x_permission.permissionid as 'permissionid', - role_x_location.locid as 'locationid' + $res = Database::simpleQuery("SELECT role_x_permission.permissionid, rxl.locationid FROM user_x_role INNER JOIN role_x_permission ON user_x_role.roleid = role_x_permission.roleid - LEFT JOIN role_x_location ON role_x_permission.roleid = role_x_location.roleid + LEFT JOIN (SELECT roleid, COALESCE(locationid, 0) AS locationid FROM role_x_location) rxl + ON role_x_permission.roleid = rxl.roleid WHERE user_x_role.userid = :userid", array("userid" => $userid)); $allowedLocations = array(); @@ -53,7 +53,7 @@ class PermissionUtil return $allowedLocations; } - private static function getSublocations($tree, $locations) { + public static function getSublocations($tree, $locations) { $result = array_flip($locations); foreach ($tree as $location) { if (array_key_exists("children", $location)) { |