summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2010-10-02 11:32:00 +0200
committerAndreas Gohr <andi@splitbrain.org>2010-10-02 11:32:00 +0200
commit75c93b7798bed5fafb8b75066adce3af14ebb524 (patch)
treee348c73455679ed19d4081c94526146e4f2e8b69 /inc/auth.php
parent93a6d0536e2b8c3e75c53753a54e7613bf4c00fe (diff)
downloadrpg-75c93b7798bed5fafb8b75066adce3af14ebb524.tar.gz
rpg-75c93b7798bed5fafb8b75066adce3af14ebb524.tar.bz2
a more correct fix for FS#2039
Diffstat (limited to 'inc/auth.php')
-rw-r--r--inc/auth.php31
1 files changed, 26 insertions, 5 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 90ce61a37..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%',auth_nameencode($_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) {