summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-06-29 14:55:35 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-06-29 14:55:35 +0200
commitbca545e60204a29018cc5002a1280a01b64594d9 (patch)
treea75a9d1529581c265cb2f428df01e9fa24504b98 /inc/auth.php
parent5d0aaf958325f500ce69cfb79e69eb0d8f83fdeb (diff)
parent8f50749b133eb2da6dc2d69adc4fb163ed9d41c2 (diff)
downloadrpg-bca545e60204a29018cc5002a1280a01b64594d9.tar.gz
rpg-bca545e60204a29018cc5002a1280a01b64594d9.tar.bz2
Merge branch 'master' of git://github.com/Aorimn/dokuwiki into pull-request-76
* 'master' of git://github.com/Aorimn/dokuwiki: Change default groupwildcards option to 0 not to change behavior of Added support for the %GROUP% wildcard. Conflicts: inc/auth.php
Diffstat (limited to 'inc/auth.php')
-rw-r--r--inc/auth.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/inc/auth.php b/inc/auth.php
index d0f21c825..58c796f2e 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -123,19 +123,28 @@ function auth_setup() {
*/
function auth_loadACL() {
global $config_cascade;
+ global $conf;
+ global $USERINFO;
if(!is_readable($config_cascade['acl']['default'])) return array();
$acl = file($config_cascade['acl']['default']);
//support user wildcard
- if(isset($_SERVER['REMOTE_USER'])) {
+ if(isset($_SERVER['REMOTE_USER']) && $conf['use_wildcards']){
$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);
+ list($id,$rest) = preg_split('/\s+/',$acl[$i],2);
+ if($conf['groups_wilcards'] && (strstr($id, '%GROUP%') || strstr($rest, '%GROUP%'))){
+ foreach($USERINFO['grps'] as $grp){
+ $nid = str_replace('%GROUP%',cleanID($grp),$id);
+ $nrest = str_replace('%GROUP%',auth_nameencode($grp),$rest);
+ $acl[] = "$nid\t$nrest";
+ }
+ }
+ $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id);
+ $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest);
$acl[$i] = "$id\t$rest";
}
}
@@ -632,6 +641,7 @@ function auth_nameencode($name, $skip_group = false) {
// never encode wildcard FS#1955
if($name == '%USER%') return $name;
+ if($name == '%GROUP%') return $name;
if(!isset($cache[$name][$skip_group])) {
if($skip_group && $name{0} == '@') {