Allow to do 'checkHasActiveRole' checks for document access
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 26 Feb 2009 16:59:24 +0000
changeset 1528 abbdf42ab322
parent 1527 0071733da7cd
child 1529 0800753ebc6a
Allow to do 'checkHasActiveRole' checks for document access This is used for documents in the site prefix. Patch by: Sverre Rabbelier
app/soc/logic/rights.py
app/soc/views/helper/access.py
--- a/app/soc/logic/rights.py	Thu Feb 26 16:58:45 2009 +0000
+++ b/app/soc/logic/rights.py	Thu Feb 26 16:59:24 2009 +0000
@@ -33,7 +33,7 @@
       'admin': [],
       'restricted': ['host'],
       'member': ['user'],
-      'list': [],
+      'list': ['host'],
       }
 
   CLUB_MEMBERSHIP = {
--- a/app/soc/views/helper/access.py	Thu Feb 26 16:58:45 2009 +0000
+++ b/app/soc/views/helper/access.py	Thu Feb 26 16:59:24 2009 +0000
@@ -233,6 +233,7 @@
   #: the depths of various scopes to other scopes
   # the 0 entries are not used, and are for clarity purposes only
   SCOPE_DEPTH = {
+      'site': None,
       'sponsor': (sponsor_logic, {'sponsor': 0}),
       'program': (program_logic, {'sponsor': 1, 'program': 0}),
       'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}),
@@ -730,7 +731,11 @@
     """
 
     prefix = django_args['prefix']
-    scope_logic, depths = self.SCOPE_DEPTH.get(prefix, (None, {}))
+    if self.SCOPE_DEPTH.get(prefix):
+      scope_logic, depths = self.SCOPE_DEPTH[prefix]
+    else:
+      return self.checkHasActiveRole(django_args, logic)
+
     depth = depths.get(target_scope, 0)
 
     # nothing to do