diff options
author | Simon Rettberg | 2019-11-05 17:38:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-11-05 17:38:04 +0100 |
commit | ddab79e04bc4ffec86946f77e0995b56fd4b0052 (patch) | |
tree | f918082e60925e0013ca9d767f940594b72d796b /modules-available/permissionmanager/inc/permissionutil.inc.php | |
parent | [locationinfo] remove scrollbar placeholder in header (diff) | |
download | slx-admin-ddab79e04bc4ffec86946f77e0995b56fd4b0052.tar.gz slx-admin-ddab79e04bc4ffec86946f77e0995b56fd4b0052.tar.xz slx-admin-ddab79e04bc4ffec86946f77e0995b56fd4b0052.zip |
[permissionmanager] Fix creating bogus negative cache entries
If a permission check for a location yielded false, a cache entry for
all parent locations with value "false" was created as well.
Diffstat (limited to 'modules-available/permissionmanager/inc/permissionutil.inc.php')
-rw-r--r-- | modules-available/permissionmanager/inc/permissionutil.inc.php | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/modules-available/permissionmanager/inc/permissionutil.inc.php b/modules-available/permissionmanager/inc/permissionutil.inc.php index 46b8c065..6aa97600 100644 --- a/modules-available/permissionmanager/inc/permissionutil.inc.php +++ b/modules-available/permissionmanager/inc/permissionutil.inc.php @@ -83,14 +83,12 @@ class PermissionUtil $locations = [0]; } else { $locations = Location::getLocationRootChain($locationid); - if (empty($locations)) { // Non-existent location, still continue as user might have global perms - $locations = [0]; - } + $locations[] = 0; } $cache =& self::$permissionCacheLoc; if (array_key_exists($key, $cache)) { if (array_key_exists($locationid, $cache[$key])) - return $cache[$key][$locationid]; // Exact match - return immedtiately + return $cache[$key][$locationid]; // Exact match - return immediately foreach ($locations as $lid) { if (array_key_exists($lid, $cache[$key]) && $cache[$key][$lid]) { $cache[$key][$locationid] = true; @@ -149,14 +147,6 @@ class PermissionUtil $cache[$key] = $retval; } else { $cache[$key][$locationid] = $retval; - if ($cacheAll) { - $locations = array_keys($allLocs); - } - foreach ($locations as $lid) { - if (!array_key_exists($lid, $cache[$key])) { - $cache[$key][$lid] = false; - } - } } return $retval; } |