Rename checkHasActiveRole to checkHasActiveRoleForScope
This is to prepare for a checker that checks if the user has any such
role, regardless of scope.
Patch by: Sverre Rabbelier
--- a/app/soc/cache/rights.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/cache/rights.py Sat Feb 07 22:49:51 2009 +0000
@@ -31,7 +31,7 @@
'checkCanMakeRequestToGroup',
'checkCanProcessRequest',
'checkHasPickGetArgs',
- 'checkHasActiveRole',
+ 'checkHasActiveRoleForScope',
'checkHasUserEntity',
'checkIsActive',
'checkIsAllowedToManageRole',
--- a/app/soc/models/group_app.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/models/group_app.py Sat Feb 07 22:49:51 2009 +0000
@@ -86,7 +86,7 @@
irc_channel.help_text = ugettext('IRC network and channel.')
backup_admin = db.ReferenceProperty(reference_class=soc.models.user.User,
- required=True, collection_name='group_app_backup_admin',
+ required=False, collection_name='group_app_backup_admin',
verbose_name=ugettext(
'Please select your backup group administrator.'))
--- a/app/soc/views/helper/access.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/helper/access.py Sat Feb 07 22:49:51 2009 +0000
@@ -197,12 +197,12 @@
MEMBERSHIP = {
'anyone': 'allow',
- 'club_admin': ('checkHasActiveRole', club_admin_logic),
- 'club_member': ('checkHasActiveRole', club_member_logic),
- 'host': ('checkHasActiveRole', host_logic),
- 'org_admin': ('checkHasActiveRole', org_admin_logic),
- 'org_mentor': ('checkHasActiveRole', mentor_logic),
- 'org_student': 'deny', #('checkHasActiveRole', student_logic),
+ 'club_admin': ('checkHasActiveRoleForScope', club_admin_logic),
+ 'club_member': ('checkHasActiveRoleForScope', club_member_logic),
+ 'host': ('checkHasActiveRoleForScope', host_logic),
+ 'org_admin': ('checkHasActiveRoleForScope', org_admin_logic),
+ 'org_mentor': ('checkHasActiveRoleForScope', mentor_logic),
+ 'org_student': 'deny', #('checkHasActiveRoleForScope', student_logic),
'user': 'checkIsUser',
'user_self': ('checkIsUserSelf', 'scope_path'),
}
@@ -581,7 +581,7 @@
raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_GROUP_MSG)
- def checkHasActiveRole(self, django_args, logic, field_name=None):
+ def checkHasActiveRoleForScope(self, django_args, logic, field_name=None):
"""Checks that the user has the specified active role.
"""
@@ -684,7 +684,7 @@
raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG)
new_args = {'scope_path': program.scope_path }
- self.checkHasActiveRole(new_args, host_logic)
+ self.checkHasActiveRoleForScope(new_args, host_logic)
@allowDeveloper
@denySidebar
@@ -859,7 +859,7 @@
try:
# check if it is my role the user's own role
- self.checkHasActiveRole(django_args, role_logic)
+ self.checkHasActiveRoleForScope(django_args, role_logic)
except out_of_band.Error:
pass
--- a/app/soc/views/models/club.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/club.py Sat Feb 07 22:49:51 2009 +0000
@@ -58,15 +58,15 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', [club_admin_logic.logic, 'link_id']),
+ rights['edit'] = [('checkHasActiveRoleForScope', [club_admin_logic.logic, 'link_id']),
('checkIsActive', [club_logic.logic, None])]
rights['delete'] = ['checkIsDeveloper']
rights['home'] = ['allow']
rights['list'] = ['checkIsDeveloper']
rights['apply_member'] = ['checkIsUser',
('checkIsActive', club_logic.logic)]
- rights['list_requests'] = [('checkHasActiveRole', [club_admin_logic.logic, 'link_id'])]
- rights['list_roles'] = [('checkHasActiveRole', [club_admin_logic.logic, 'link_id'])]
+ rights['list_requests'] = [('checkHasActiveRoleForScope', [club_admin_logic.logic, 'link_id'])]
+ rights['list_roles'] = [('checkHasActiveRoleForScope', [club_admin_logic.logic, 'link_id'])]
rights['applicant'] = [('checkIsApplicationAccepted',
club_app_logic.logic)]
--- a/app/soc/views/models/club_admin.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/club_admin.py Sat Feb 07 22:49:51 2009 +0000
@@ -51,11 +51,11 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', club_admin_logic.logic)]
+ rights['edit'] = [('checkHasActiveRoleForScope', club_admin_logic.logic)]
rights['delete'] = ['checkIsDeveloper']
- rights['invite'] = [('checkHasActiveRole', club_admin_logic.logic)]
+ rights['invite'] = [('checkHasActiveRoleForScope', club_admin_logic.logic)]
rights['accept_invite'] = [('checkCanCreateFromRequest', 'club_admin')]
- rights['process_request'] = [('checkHasActiveRole', club_admin_logic.logic),
+ rights['process_request'] = [('checkHasActiveRoleForScope', club_admin_logic.logic),
('checkCanProcessRequest', 'club_admin')]
rights['manage'] = [('checkIsAllowedToManageRole',
[club_admin_logic.logic,
--- a/app/soc/views/models/club_app.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/club_app.py Sat Feb 07 22:49:51 2009 +0000
@@ -58,9 +58,9 @@
rights['public'] = [('checkCanEditGroupApp',
[club_app_logic.logic])]
# TODO(ljvderijk) make sure host role check is fixed
- rights['review'] = [('checkHasActiveRole', host_logic.logic),
+ rights['review'] = [('checkHasActiveRoleForScope', host_logic.logic),
('checkCanReviewGroupApp', [club_app_logic.logic])]
- rights['review_overview'] = [('checkHasActiveRole', host_logic.logic)]
+ rights['review_overview'] = [('checkHasActiveRoleForScope', host_logic.logic)]
new_params = {}
--- a/app/soc/views/models/club_member.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/club_member.py Sat Feb 07 22:49:51 2009 +0000
@@ -51,13 +51,13 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', club_admin_logic.logic)]
+ rights['edit'] = [('checkHasActiveRoleForScope', club_admin_logic.logic)]
rights['delete'] = ['checkIsDeveloper']
- rights['invite'] = [('checkHasActiveRole', club_admin_logic.logic)]
+ rights['invite'] = [('checkHasActiveRoleForScope', club_admin_logic.logic)]
rights['accept_invite'] = [('checkCanCreateFromRequest','club_member')]
rights['request'] = ['checkIsUser',
('checkCanMakeRequestToGroup', club_logic)]
- rights['process_request'] = [('checkHasActiveRole', club_admin_logic.logic),
+ rights['process_request'] = [('checkHasActiveRoleForScope', club_admin_logic.logic),
('checkCanProcessRequest','club_member')]
rights['manage'] = [('checkIsAllowedToManageRole',
[soc.logic.models.club_member.logic,
--- a/app/soc/views/models/group_app.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/group_app.py Sat Feb 07 22:49:51 2009 +0000
@@ -80,7 +80,7 @@
new_params['create_extra_dynafields'] = {
'backup_admin_link_id': widgets.ReferenceField(
- reference_url='user',
+ reference_url='user', required=False,
label=params['logic'].getModel().backup_admin.verbose_name),
'clean_backup_admin_link_id':
cleaning.clean_users_not_same('backup_admin_link_id'),
--- a/app/soc/views/models/host.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/host.py Sat Feb 07 22:49:51 2009 +0000
@@ -56,12 +56,12 @@
"""
rights = access.Checker(params)
- rights['create'] = [('checkHasActiveRole', host_logic.logic)]
- rights['edit'] = [('checkHasActiveRole', host_logic.logic)]
- rights['invite'] = [('checkHasActiveRole', host_logic.logic)]
+ rights['create'] = [('checkHasActiveRoleForScope', host_logic.logic)]
+ rights['edit'] = [('checkHasActiveRoleForScope', host_logic.logic)]
+ rights['invite'] = [('checkHasActiveRoleForScope', host_logic.logic)]
rights['list'] = ['checkIsDeveloper']
rights['accept_invite'] = [('checkCanCreateFromRequest','host')]
- rights['process_request'] = [('checkHasActiveRole', host_logic.logic),
+ rights['process_request'] = [('checkHasActiveRoleForScope', host_logic.logic),
('checkCanProcessRequest','host')]
rights['manage'] = [('checkIsAllowedToManageRole',
[host_logic.logic, host_logic.logic])]
--- a/app/soc/views/models/mentor.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/mentor.py Sat Feb 07 22:49:51 2009 +0000
@@ -50,7 +50,7 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', soc.logic.models.mentor.logic)]
+ rights['edit'] = [('checkHasActiveRoleForScope', soc.logic.models.mentor.logic)]
rights['delete'] = ['checkIsDeveloper']
# TODO accessCheck checkIsAdministratorForOrg
rights['invite'] = ['checkIsDeveloper']
--- a/app/soc/views/models/org_admin.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/org_admin.py Sat Feb 07 22:49:51 2009 +0000
@@ -50,7 +50,7 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', org_admin_logic.logic)]
+ rights['edit'] = [('checkHasActiveRoleForScope', org_admin_logic.logic)]
rights['delete'] = ['checkIsDeveloper']
# TODO accessCheck checkIsAdministratorForOrg
rights['invite'] = ['checkIsDeveloper']
--- a/app/soc/views/models/program.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/program.py Sat Feb 07 22:49:51 2009 +0000
@@ -58,7 +58,7 @@
rights = access.Checker(params)
rights['any_access'] = ['allow']
rights['show'] = ['allow']
- rights['create'] = [('checkSeeded', ['checkHasActiveRole', host_logic.logic])]
+ rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope', host_logic.logic])]
rights['edit'] = ['checkIsHostForProgram']
rights['delete'] = ['checkIsDeveloper']
--- a/app/soc/views/models/sponsor.py Sat Feb 07 22:47:51 2009 +0000
+++ b/app/soc/views/models/sponsor.py Sat Feb 07 22:49:51 2009 +0000
@@ -50,13 +50,13 @@
rights = access.Checker(params)
rights['create'] = ['checkIsDeveloper']
- rights['edit'] = [('checkHasActiveRole', [host_logic, 'link_id']),
+ rights['edit'] = [('checkHasActiveRoleForScope', [host_logic, 'link_id']),
('checkIsActive', [sponsor_logic, None, 'link_id'])]
rights['delete'] = ['checkIsDeveloper']
- rights['home'] = [('checkHasActiveRole', host_logic)]
+ rights['home'] = [('checkHasActiveRoleForScope', host_logic)]
rights['list'] = ['checkIsDeveloper']
- rights['list_requests'] = [('checkHasActiveRole', [host_logic, 'link_id'])]
- rights['list_roles'] = [('checkHasActiveRole', [host_logic, 'link_id'])]
+ rights['list_requests'] = [('checkHasActiveRoleForScope', [host_logic, 'link_id'])]
+ rights['list_roles'] = [('checkHasActiveRoleForScope', [host_logic, 'link_id'])]
new_params = {}
new_params['logic'] = soc.logic.models.sponsor.logic