diff options
author | Sascha Klopp <klopp@rrzn.uni-hannover.de> | 2015-06-12 12:30:57 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-07-18 12:58:42 +0200 |
commit | 37ff2261e7a45a16a844d538a64b1fee54d2eb05 (patch) | |
tree | 48fafaa43fa870b9449b366bdf1ac28f3c00c1d2 /inc/auth.php | |
parent | 82246f10eb9ae3debeadf5913232105aa2694cec (diff) | |
download | rpg-37ff2261e7a45a16a844d538a64b1fee54d2eb05.tar.gz rpg-37ff2261e7a45a16a844d538a64b1fee54d2eb05.tar.bz2 |
correctly handle usergroups array
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/inc/auth.php b/inc/auth.php index 60b8c7c78..e04a6ca1a 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -739,28 +739,23 @@ function auth_aclcheck_cb($data) { $user = utf8_strtolower($user); $groups = array_map('utf8_strtolower', $groups); } - $user = $auth->cleanUser($user); + $user = auth_nameencode($auth->cleanUser($user)); $groups = array_map(array($auth, 'cleanGroup'), (array) $groups); - $user = auth_nameencode($user); //prepend groups with @ and nameencode - $cnt = count($groups); - for($i = 0; $i < $cnt; $i++) { - $groups[$i] = '@'.auth_nameencode($groups[$i]); + foreach($groups as &$group) { + $group = '@'.auth_nameencode($group); } $ns = getNS($id); $perm = -1; - if($user || count($groups)) { - //add ALL group - $groups[] = '@ALL'; - //add User - if($user) $groups[] = $user; - } else { - $groups[] = '@ALL'; - } - + //add ALL group + $groups[] = '@ALL'; + + //add User + if($user) $groups[] = $user; + //check exact match first $matches = preg_grep('/^'.preg_quote($id, '/').'[ \t]+([^ \t]+)[ \t]+/', $AUTH_ACL); if(count($matches)) { |