Commits

cmlenz  committed 3ed7aef

Ported authz fixes [1181], [1183] and [1184] to stable.

  • Participants
  • Parent commits b63fbdc
  • Branches 0.8-stable

Comments (0)

Files changed (1)

File trac/authzperm.py

     authz_file = ''
     
     def __init__(self,env,authname):
-        if authname == 'anonymous':
-            self.auth_name = '*'
-        else:
-            self.auth_name = authname
+	self.auth_name = authname
+	
 	if env.get_config('trac','authz_module_name','') == '':
 	    self.module_name = ''
 	else:
         return False
     
     def has_permission(self, path):
-        acc = 'r'
+        acc = ''
 
         if path != None and self.conf_authz != None:
             if self.conf_authz.has_section(self.module_name + '/') and \
                    self.conf_authz.has_option(self.module_name  + '/',
                                               self.auth_name):
                 acc = self.conf_authz.get(self.module_name + '/',self.auth_name)
-
+	    elif self.conf_authz.has_section(self.module_name + '/') and \
+	         self.conf_authz.has_option(self.module_name  + '/', '*'):
+		     acc = self.conf_authz.get(self.module_name + '/','*')
             path_comb = ''
             for path_ele in path.split('/'):
                 if path_ele != '':
                     if self.conf_authz.has_section(self.module_name + path_comb) and \
                            self.conf_authz.has_option(self.module_name + path_comb,self.auth_name):
                         acc =  self.conf_authz.get(self.module_name + path_comb,self.auth_name)
+		    elif self.conf_authz.has_section(self.module_name + path_comb) and \
+		            self.conf_authz.has_option(self.module_name + path_comb,'*'):
+		        acc =  self.conf_authz.get(self.module_name + path_comb,'*')
+        else:
+            acc = 'r'
         return acc
 
     def assert_permission (self, path):