Properly fixed host access now
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 28 Feb 2009 12:32:52 +0000
changeset 1557 9e32e6258319
parent 1556 c81109a8a1a1
child 1558 5ff25327371e
Properly fixed host access now Patch by: Sverre Rabbelier
app/soc/views/helper/access.py
app/soc/views/models/sponsor.py
--- a/app/soc/views/helper/access.py	Sat Feb 28 12:11:20 2009 +0000
+++ b/app/soc/views/helper/access.py	Sat Feb 28 12:32:52 2009 +0000
@@ -726,8 +726,20 @@
     Only roles where the link_id matches the link_id from the
     django_args are considered.
     """
+
     self._checkHasActiveRoleFor(django_args, logic, 'link_id')
 
+  def checkHasActiveRoleForLinkIdAsScope(self, django_args, logic):
+    """Checks that the user has the specified active role.
+
+    Only roles where the link_id matches the link_id from the
+    django_args are considered.
+    """
+
+    django_args = django_args.copy()
+    django_args['scope_path'] = django_args['link_id']
+    self._checkHasActiveRoleFor(django_args, logic, 'scope_path')
+
   def checkHasDocumentAccess(self, django_args, logic, target_scope):
     """Checks that the user has access to the specified document scope.
     """
--- a/app/soc/views/models/sponsor.py	Sat Feb 28 12:11:20 2009 +0000
+++ b/app/soc/views/models/sponsor.py	Sat Feb 28 12:32:52 2009 +0000
@@ -50,13 +50,13 @@
 
     rights = access.Checker(params)
     rights['create'] = ['checkIsDeveloper']
-    rights['edit'] = [('checkHasActiveRoleForLinkId', host_logic),
+    rights['edit'] = [('checkHasActiveRoleForLinkIdAsScope', host_logic),
                       ('checkGroupIsActiveForLinkId', sponsor_logic)]
     rights['delete'] = ['checkIsDeveloper']
     rights['home'] = [('checkHasActiveRoleForScope', host_logic)]
     rights['list'] = ['checkIsDeveloper']
-    rights['list_requests'] = [('checkHasActiveRoleForScope', host_logic)]
-    rights['list_roles'] = [('checkHasActiveRoleForScope', host_logic)]
+    rights['list_requests'] = [('checkHasActiveRoleForLinkIdAsScope', host_logic)]
+    rights['list_roles'] = [('checkHasActiveRoleForLinkIdAsScope', host_logic)]
 
     new_params = {}
     new_params['logic'] = soc.logic.models.sponsor.logic