~ubuntu-branches/ubuntu/edgy/trac/edgy

« back to all changes in this revision

Viewing changes to trac/authzperm.py

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2005-07-24 12:21:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050724122152-3xf8v1oqf2jcqk5n
Tags: 0.8.4-1ubuntu1
Resynchronise with Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    authz_file = ''
38
38
    
39
39
    def __init__(self,env,authname):
40
 
        if authname == 'anonymous':
41
 
            self.auth_name = '*'
42
 
        else:
43
 
            self.auth_name = authname
 
40
        self.auth_name = authname
 
41
        
44
42
        if env.get_config('trac','authz_module_name','') == '':
45
43
            self.module_name = ''
46
44
        else:
59
57
        return False
60
58
    
61
59
    def has_permission(self, path):
62
 
        acc = 'r'
 
60
        acc = ''
63
61
 
64
62
        if path != None and self.conf_authz != None:
65
63
            if self.conf_authz.has_section(self.module_name + '/') and \
66
64
                   self.conf_authz.has_option(self.module_name  + '/',
67
65
                                              self.auth_name):
68
66
                acc = self.conf_authz.get(self.module_name + '/',self.auth_name)
69
 
 
 
67
            elif self.conf_authz.has_section(self.module_name + '/') and \
 
68
                 self.conf_authz.has_option(self.module_name  + '/', '*'):
 
69
                     acc = self.conf_authz.get(self.module_name + '/','*')
70
70
            path_comb = ''
71
71
            for path_ele in path.split('/'):
72
72
                if path_ele != '':
74
74
                    if self.conf_authz.has_section(self.module_name + path_comb) and \
75
75
                           self.conf_authz.has_option(self.module_name + path_comb,self.auth_name):
76
76
                        acc =  self.conf_authz.get(self.module_name + path_comb,self.auth_name)
 
77
                    elif self.conf_authz.has_section(self.module_name + path_comb) and \
 
78
                            self.conf_authz.has_option(self.module_name + path_comb,'*'):
 
79
                        acc =  self.conf_authz.get(self.module_name + path_comb,'*')
 
80
        else:
 
81
            acc = 'r'
77
82
        return acc
78
83
 
79
84
    def assert_permission (self, path):