From 9ce556d25f58ffae2f7937ab763f84118a6c6464 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sat, 30 Jun 2012 15:23:34 +0200 Subject: [PATCH] fixed ACL loading after the recent changes/messup --- inc/auth.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/inc/auth.php b/inc/auth.php index 26f4000fd..cedfdee36 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -131,26 +131,24 @@ function auth_loadACL() { //support user wildcard $out = array(); - if(isset($_SERVER['REMOTE_USER'])){ - $len = count($acl); - for($i = 0; $i < $len; $i++) { - if($acl[$i]{0} == '#') continue; - if(!trim($acl[$i])) continue; - list($id,$rest) = preg_split('/\s+/',$acl[$i],2); - - if(strstr($acl[$i], '%GROUP%')){ - foreach($USERINFO['grps'] as $grp){ - $nid = str_replace('%GROUP%',cleanID($grp),$id); - $nrest = str_replace('%GROUP%','@'.auth_nameencode($grp),$rest); - $out[] = "$nid\t$nrest"; - } - } else { - $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); - $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); - $out[] = "$id\t$rest"; + foreach($acl as $line) { + $line = trim($line); + if($line{0} == '#') continue; + list($id,$rest) = preg_split('/\s+/',$line,2); + + if(strstr($line, '%GROUP%')){ + foreach((array) $USERINFO['grps'] as $grp){ + $nid = str_replace('%GROUP%',cleanID($grp),$id); + $nrest = str_replace('%GROUP%','@'.auth_nameencode($grp),$rest); + $out[] = "$nid\t$nrest"; } + } else { + $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); + $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); + $out[] = "$id\t$rest"; } } + return $out; } -- GitLab