Use .logic in checkIsAllowedToManageRole at the caller
This is to be consistent with the rest of the module.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/access.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/helper/access.py Mon Feb 02 16:03:21 2009 +0000
@@ -548,12 +548,15 @@
raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_GROUP_MSG)
- def checkHasRole(self, django_args, logic):
+ def checkHasRole(self, django_args, logic, field_name=None):
"""Checks that the user has the specified role.
"""
+ if not field_name:
+ field_name = 'scope_path'
+
django_args['user'] = self.user
- self.checkIsActive(django_args, logic, 'scope_path', 'user')
+ self.checkIsActive(django_args, logic, field_name, 'user')
def checkCanMakeRequestToGroup(self, django_args, group_logic):
"""Raises an alternate HTTP response if the specified group is not in an
@@ -726,7 +729,7 @@
'status': 'active',
}
- role_entity = role_logic.logic.getForFields(fields)
+ role_entity = role_logic.getForFields(fields)
fields = {
'link_id': self.user.link_id,
@@ -734,7 +737,7 @@
'status': 'active'
}
- manage_entity = manage_role_logic.logic.getForFields(fields, unique=True)
+ manage_entity = manage_role_logic.getForFields(fields, unique=True)
if not manage_entity:
self.deny(django_args)
--- a/app/soc/views/models/club.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/club.py Mon Feb 02 16:03:21 2009 +0000
@@ -65,8 +65,8 @@
rights['list'] = ['checkIsDeveloper']
rights['apply_member'] = ['checkIsUser',
('checkIsActive', club_logic.logic)]
- rights['list_requests'] = [('checkHasRole', club_admin_logic.logic)]
- rights['list_roles'] = [('checkHasRole', club_admin_logic.logic)]
+ rights['list_requests'] = [('checkHasRole', [club_admin_logic.logic, 'link_id'])]
+ rights['list_roles'] = [('checkHasRole', [club_admin_logic.logic, 'link_id'])]
rights['applicant'] = [('checkIsApplicationAccepted',
club_app_logic.logic)]
--- a/app/soc/views/models/club_admin.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/club_admin.py Mon Feb 02 16:03:21 2009 +0000
@@ -58,8 +58,8 @@
rights['process_request'] = [('checkHasRole', club_admin_logic.logic),
('checkCanProcessRequest', 'club_admin')]
rights['manage'] = [('checkIsAllowedToManageRole',
- [soc.logic.models.club_admin,
- soc.logic.models.club_admin])]
+ [club_admin_logic.logic,
+ club_admin_logic.logic])]
new_params = {}
new_params['logic'] = soc.logic.models.club_admin.logic
--- a/app/soc/views/models/club_member.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/club_member.py Mon Feb 02 16:03:21 2009 +0000
@@ -60,8 +60,8 @@
rights['process_request'] = [('checkHasRole', club_admin_logic.logic),
('checkCanProcessRequest','club_member')]
rights['manage'] = [('checkIsAllowedToManageRole',
- [soc.logic.models.club_member,
- soc.logic.models.club_admin])]
+ [soc.logic.models.club_member.logic,
+ club_admin_logic.logic])]
new_params = {}
new_params['logic'] = soc.logic.models.club_member.logic
--- a/app/soc/views/models/host.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/host.py Mon Feb 02 16:03:21 2009 +0000
@@ -64,7 +64,7 @@
rights['process_request'] = [('checkHasRole', host_logic.logic),
('checkCanProcessRequest','host')]
rights['manage'] = [('checkIsAllowedToManageRole',
- [host_logic, host_logic])]
+ [host_logic.logic, host_logic.logic])]
new_params = {}
new_params['rights'] = rights
--- a/app/soc/views/models/mentor.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/mentor.py Mon Feb 02 16:03:21 2009 +0000
@@ -59,8 +59,8 @@
rights['process_request'] = ['checkIsDeveloper',
('checkCanProcessRequest', 'mentor')]
rights['manage'] = [
- ('checkIsAllowedToManageRole', [soc.logic.models.mentor,
- soc.logic.models.org_admin])]
+ ('checkIsAllowedToManageRole', [soc.logic.models.mentor.logic,
+ soc.logic.models.org_admin.logic])]
new_params = {}
new_params['logic'] = soc.logic.models.mentor.logic
--- a/app/soc/views/models/org_admin.py Mon Feb 02 15:39:22 2009 +0000
+++ b/app/soc/views/models/org_admin.py Mon Feb 02 16:03:21 2009 +0000
@@ -59,8 +59,8 @@
rights['process_request'] = ['checkIsDeveloper',
('checkCanProcessRequest', 'org_admin')]
rights['manage'] = [
- ('checkIsAllowedToManageRole', [soc.logic.models.org_admin,
- soc.logic.models.org_admin])]
+ ('checkIsAllowedToManageRole', [soc.logic.models.org_admin.logic,
+ soc.logic.models.org_admin.logic])]
new_params = {}
new_params['logic'] = soc.logic.models.org_admin.logic