From 85d03f688ed419d3e426dbb8187bf954d9a7a358 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Tue, 26 Feb 2008 18:22:57 +0100
Subject: [PATCH] fix usage of is_admin in auth_aclcheck

There were a few problems with name encoding for groups and users
introduced in the recent aclcheck change

darcs-hash:20080226172257-7ad00-d591f0d2f2219a2b23f93060c65b8fb5f46bd1d7.gz
---
 inc/auth.php | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/inc/auth.php b/inc/auth.php
index 10f33bcf3..85576b680 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -344,24 +344,22 @@ function auth_aclcheck($id,$user,$groups){
   global $conf;
   global $AUTH_ACL;
 
-  # if no ACL is used always return upload rights
+  // if no ACL is used always return upload rights
   if(!$conf['useacl']) return AUTH_UPLOAD;
 
-  $user = auth_nameencode($user);
+  //make sure groups is an array
+  if(!is_array($groups)) $groups = array();
 
-  //if user is superuser return 255 (acl_admin)
+  //if user is superuser or in superusergroup return 255 (acl_admin)
   if(auth_isadmin($user,$groups)) { return AUTH_ADMIN; }
 
-  //make sure groups is an array
-  if(!is_array($groups)) $groups = array();
+  $user = auth_nameencode($user);
 
   //prepend groups with @ and nameencode
   $cnt = count($groups);
   for($i=0; $i<$cnt; $i++){
     $groups[$i] = '@'.auth_nameencode($groups[$i]);
   }
-  //if user is in superuser group return 255 (acl_admin)
-  if(auth_isadmin($user,$groups)) { return AUTH_ADMIN; }
 
   $ns    = getNS($id);
   $perm  = -1;
-- 
GitLab