Unverified Commit e600b58f authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(acls) Fix menu building when ACL for all is given on single object

issue #5531
Showing with 4 additions and 3 deletions
+4 -3
...@@ -687,13 +687,13 @@ class userinfo ...@@ -687,13 +687,13 @@ class userinfo
* Extract all departments that are accessible (direct or 'on the way' to an * Extract all departments that are accessible (direct or 'on the way' to an
* accessible department) * accessible department)
* *
* \param string $module The module * \param string|array $module The module
* *
* \param bool $skip_self_acls FALSE * \param bool $skip_self_acls FALSE
* *
* \return array Return all accessible departments * \return array Return all accessible departments
*/ */
function get_module_departments ($module, $skip_self_acls = FALSE) function get_module_departments ($module, bool $skip_self_acls = FALSE): array
{ {
global $config; global $config;
/* If we are forced to skip ACLs checks for the current user /* If we are forced to skip ACLs checks for the current user
...@@ -730,7 +730,8 @@ class userinfo ...@@ -730,7 +730,8 @@ class userinfo
if ($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) { if ($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) {
continue; continue;
} }
if (preg_match("/^".preg_quote($mod, '/')."/", $cat)) { if (preg_match('/^'.preg_quote($mod, '/').'/', $cat) || ($cat === 'all')) {
/* $cat starts with $mod (example: cat=user/user and mod=user) or cat is 'all' */
$found = TRUE; $found = TRUE;
break; break;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment