From c19fe9c0f68f58ff9c18f0e185a5bc6b591bf798 Mon Sep 17 00:00:00 2001 From: andi Date: Tue, 15 Mar 2005 22:30:05 +0100 Subject: template fixes and ACL admin interface darcs-hash:20050315213005-9977f-0939681aa5ee37e0ea8cb054ffddb8e6275aa398.gz --- inc/acl_admin.php | 121 ------------------------------------------------------ 1 file changed, 121 deletions(-) delete mode 100644 inc/acl_admin.php (limited to 'inc/acl_admin.php') diff --git a/inc/acl_admin.php b/inc/acl_admin.php deleted file mode 100644 index f7cd7fbd7..000000000 --- a/inc/acl_admin.php +++ /dev/null @@ -1,121 +0,0 @@ - - */ -function get_acl_config($ID){ - global $AUTH_ACL; - - $acl_config=array(); - - // match exact name - $matches = preg_grep('/^'.$ID.'\s+.*/',$AUTH_ACL); - if(count($matches)){ - foreach($matches as $match){ - $match = preg_replace('/#.*$/','',$match); //ignore comments - $acl = preg_split('/\s+/',$match); - //0 is pagename, 1 is user, 2 is acl - $acl_config["$acl[0]"][]=array($acl[1],$acl[2]); - } - } - - $specific_found=array(); - // match ns - if(($ID=getNS($ID)) !== false){ - $matches = preg_grep('/^'.$ID.':\*\s+.*/',$AUTH_ACL); - if(count($matches)){ - foreach($matches as $match){ - $match = preg_replace('/#.*$/','',$match); //ignore comments - $acl = preg_split('/\s+/',$match); - //0 is pagename, 1 is user, 2 is acl - $acl_config["$acl[0]"][]=array($acl[1],$acl[2]); - $specific_found[]=$acl[1]; - } - } - } - - //include *-config - $matches = preg_grep('/^\*\s+.*/',$AUTH_ACL); - if(count($matches)){ - foreach($matches as $match){ - $match = preg_replace('/#.*$/','',$match); //ignore comments - $acl = preg_split('/\s+/',$match); - // only include * for this user if not already found in ns - if(!in_array($acl[1], $specific_found)){ - //0 is pagename, 1 is user, 2 is acl - $acl_config["$acl[0]"][]=array($acl[1],$acl[2]); - } - } - } - - //sort - //FIXME: better sort algo: first sort by key, then sort by first value - krsort($acl_config, SORT_STRING); - - return($acl_config); -} - -/** - * adds new acl-entry to conf/acl.auth - * - * @author Frank Schubert - */ -function acl_admin_add($acl_scope, $acl_user, $acl_level){ - if($acl_scope === '' || $acl_user === '' || $acl_level === '') { return false; } - - $acl_config = join("",file('conf/acl.auth')); - - // max level for pagenames is 2 - if(strpos("*", $acl_scope) === false) { - if($acl_level > 2) { $acl_level = 2; } - } - - $new_acl = "$acl_scope\t$acl_user\t$acl_level\n"; - - $new_config = $acl_config.$new_acl; - - return io_saveFile("conf/acl.auth", $new_config); -} - -/** - * remove acl-entry from conf/acl.auth - * - * @author Frank Schubert - */ -function acl_admin_del($acl_scope, $acl_user, $acl_level){ - if($acl_scope === '' || $acl_user === '' || $acl_level === '') { return false; } - - $acl_pattern = preg_quote($acl_scope)."\s+".$acl_user."\s+".$acl_level."\n"; - - $acl_config = file('conf/acl.auth'); - - // save all non!-matching - $new_config = preg_grep("/$acl_pattern/", $acl_config, PREG_GREP_INVERT); - - return io_saveFile("conf/acl.auth", join("",$new_config)); -} - -/** - * change existing acl entries - * - * @author Frank Schubert - */ -function acl_admin_change($acl_scope, $acl_user, $acl_level, $acl_checkbox){ - - $new_level = 0; - if(is_array($acl_checkbox)) { - foreach($acl_checkbox as $acl_num => $value){ - if( ($value == "on") && - ($acl_num > $new_level)) { - $new_level = $acl_num; - } - } - } - - acl_admin_del($acl_scope, $acl_user, $acl_level); - acl_admin_add($acl_scope, $acl_user, $new_level); -} -?> -- cgit v1.2.3