diff options
author | Michael Hamann <michael@content-space.de> | 2010-10-10 14:26:22 +0200 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2010-10-10 14:26:22 +0200 |
commit | 762b4c44c691f69d521413d7016314e7f547c102 (patch) | |
tree | 95ab294b1df2f8c7a5efb56762a0f284bec3754e /inc/auth.php | |
parent | eae17177de8f3f3580af5ea66d126aee0f23227f (diff) | |
parent | 4ea48b361401e136dbfd3339af368ceeb5b27480 (diff) | |
download | rpg-762b4c44c691f69d521413d7016314e7f547c102.tar.gz rpg-762b4c44c691f69d521413d7016314e7f547c102.tar.bz2 |
Merge remote branch 'origin/master' into sitemap
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/inc/auth.php b/inc/auth.php index e1f689f96..a2844a732 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -103,13 +103,34 @@ function auth_setup(){ } //load ACL into a global array XXX - if(is_readable($config_cascade['acl']['default'])){ - $AUTH_ACL = file($config_cascade['acl']['default']); - //support user wildcard - if(isset($_SERVER['REMOTE_USER'])){ - $AUTH_ACL = str_replace('%USER%',$_SERVER['REMOTE_USER'],$AUTH_ACL); + $AUTH_ACL = auth_loadACL(); +} + +/** + * Loads the ACL setup and handle user wildcards + * + * @author Andreas Gohr <andi@splitbrain.org> + * @returns array + */ +function auth_loadACL(){ + global $config_cascade; + + if(!is_readable($config_cascade['acl']['default'])) return array(); + + $acl = file($config_cascade['acl']['default']); + + //support user wildcard + if(isset($_SERVER['REMOTE_USER'])){ + $len = count($acl); + for($i=0; $i<$len; $i++){ + if($acl[$i]{0} == '#') continue; + list($id,$rest) = preg_split('/\s+/',$acl[$i],2); + $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); + $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); + $acl[$i] = "$id\t$rest"; } } + return $acl; } function auth_login_wrapper($evdata) { |