equal
deleted
inserted
replaced
231 } |
231 } |
232 |
232 |
233 #: the depths of various scopes to other scopes |
233 #: the depths of various scopes to other scopes |
234 # the 0 entries are not used, and are for clarity purposes only |
234 # the 0 entries are not used, and are for clarity purposes only |
235 SCOPE_DEPTH = { |
235 SCOPE_DEPTH = { |
|
236 'site': None, |
236 'sponsor': (sponsor_logic, {'sponsor': 0}), |
237 'sponsor': (sponsor_logic, {'sponsor': 0}), |
237 'program': (program_logic, {'sponsor': 1, 'program': 0}), |
238 'program': (program_logic, {'sponsor': 1, 'program': 0}), |
238 'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}), |
239 'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}), |
239 } |
240 } |
240 |
241 |
728 def checkHasDocumentAccess(self, django_args, logic, target_scope): |
729 def checkHasDocumentAccess(self, django_args, logic, target_scope): |
729 """Checks that the user has access to the specified document scope. |
730 """Checks that the user has access to the specified document scope. |
730 """ |
731 """ |
731 |
732 |
732 prefix = django_args['prefix'] |
733 prefix = django_args['prefix'] |
733 scope_logic, depths = self.SCOPE_DEPTH.get(prefix, (None, {})) |
734 if self.SCOPE_DEPTH.get(prefix): |
|
735 scope_logic, depths = self.SCOPE_DEPTH[prefix] |
|
736 else: |
|
737 return self.checkHasActiveRole(django_args, logic) |
|
738 |
734 depth = depths.get(target_scope, 0) |
739 depth = depths.get(target_scope, 0) |
735 |
740 |
736 # nothing to do |
741 # nothing to do |
737 if not (scope_logic and depth): |
742 if not (scope_logic and depth): |
738 return self.checkHasActiveRoleForScope(django_args, logic) |
743 return self.checkHasActiveRoleForScope(django_args, logic) |