checkIsHostForProgram function takes a new 'logic' argument.
It determines which logic should be used to look up for program entity. If the argument is not given, the standard program_logic will be used.
--- a/app/soc/modules/ghop/views/models/program.py Thu Oct 29 22:58:06 2009 +0100
+++ b/app/soc/modules/ghop/views/models/program.py Fri Oct 30 01:23:37 2009 +0100
@@ -88,20 +88,19 @@
rights['show'] = ['allow']
rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope',
host_logic.logic])]
- rights['edit'] = [('checkIsHostForProgram',
- [ghop_program_logic.logic])]
+ rights['edit'] = [('checkIsHostForProgram', [ghop_program_logic.logic])]
rights['delete'] = ['checkIsDeveloper']
rights['accepted_orgs'] = [('checkIsAfterEvent',
['student_signup_start',
'__all__', ghop_program_logic.logic])]
rights['task_difficulty'] = [('checkIsHostForProgram',
- [ghop_program_logic.logic])]
+ [ghop_program_logic.logic])]
rights['task_type'] = [('checkIsHostForProgram',
- [ghop_program_logic.logic])]
+ [ghop_program_logic.logic])]
rights['difficulty_tag_edit'] = [('checkIsHostForProgram',
- [ghop_program_logic.logic])]
+ [ghop_program_logic.logic])]
rights['type_tag_edit'] = [('checkIsHostForProgram',
- [ghop_program_logic.logic])]
+ [ghop_program_logic.logic])]
new_params = {}
new_params['logic'] = soc.modules.ghop.logic.models.program.logic
--- a/app/soc/modules/gsoc/views/models/program.py Thu Oct 29 22:58:06 2009 +0100
+++ b/app/soc/modules/gsoc/views/models/program.py Fri Oct 30 01:23:37 2009 +0100
@@ -49,12 +49,14 @@
rights['show'] = ['allow']
rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope',
host_logic])]
- rights['edit'] = ['checkIsHostForProgram']
+ rights['edit'] = [('checkIsHostForProgram', [program_logic.logic])]
rights['delete'] = ['checkIsDeveloper']
- rights['assign_slots'] = ['checkIsHostForProgram']
- rights['slots'] = ['checkIsHostForProgram']
- rights['show_duplicates'] = ['checkIsHostForProgram']
- rights['assigned_proposals'] = ['checkIsHostForProgram']
+ rights['assign_slots'] = [('checkIsHostForProgram', [program_logic.logic])]
+ rights['slots'] = [('checkIsHostForProgram', [program_logic.logic])]
+ rights['show_duplicates'] = [('checkIsHostForProgram',
+ [program_logic.logic])]
+ rights['assigned_proposals'] = [('checkIsHostForProgram',
+ [program_logic.logic])]
rights['accepted_orgs'] = [('checkIsAfterEvent',
['accepted_organization_announced_deadline',
'__all__', program_logic])]
--- a/app/soc/views/helper/access.py Thu Oct 29 22:58:06 2009 +0100
+++ b/app/soc/views/helper/access.py Fri Oct 30 01:23:37 2009 +0100
@@ -983,13 +983,18 @@
@allowDeveloper
@denySidebar
- def checkIsHostForProgram(self, django_args):
+ def checkIsHostForProgram(self, django_args, logic):
"""Checks if the user is a host for the specified program.
Args:
django_args: a dictionary with django's arguments
+ logic: the logic used to look up for program entity; if not specified
+ standard program_logic will be used
"""
+ if not logic:
+ logic = program_logic
+
program = program_logic.getFromKeyFields(django_args)
if not program or program.status == 'invalid':