Prepared Survey access controls to deal with multiple logics.
Also added a TODO to move a method to another view.
--- a/app/soc/views/helper/access.py Mon Jun 29 15:19:28 2009 +0200
+++ b/app/soc/views/helper/access.py Mon Jun 29 15:44:33 2009 +0200
@@ -1512,7 +1512,7 @@
@allowSidebar
@allowDeveloper
- def checkIsSurveyReadable(self, django_args, key_name_field=None):
+ def checkIsSurveyReadable(self, django_args, survey_logic, key_name_field=None):
"""Checks whether a survey is readable.
Args:
@@ -1531,7 +1531,7 @@
@denySidebar
@allowDeveloper
- def checkIsSurveyWritable(self, django_args, key_name_field=None):
+ def checkIsSurveyWritable(self, django_args, survey_logic, key_name_field=None):
"""Checks whether a survey is writable.
Args:
--- a/app/soc/views/models/survey.py Mon Jun 29 15:19:28 2009 +0200
+++ b/app/soc/views/models/survey.py Mon Jun 29 15:44:33 2009 +0200
@@ -102,13 +102,12 @@
rights = access.Checker(params)
rights['any_access'] = ['allow']
- rights['show'] = ['checkIsSurveyReadable']
+ rights['show'] = [('checkIsSurveyReadable', survey_logic)]
rights['create'] = ['checkIsUser']
- rights['edit'] = ['checkIsSurveyWritable']
- rights['delete'] = ['checkIsSurveyWritable']
+ rights['edit'] = [('checkIsSurveyWritable', survey_logic)]
+ rights['delete'] = [('checkIsSurveyWritable', survey_logic)]
rights['list'] = ['checkDocumentList']
rights['pick'] = ['checkDocumentPick']
- rights['grade'] = ['checkIsSurveyGradable']
new_params = {}
# TODO(ajaksu) pass logic in a way views can use them
@@ -720,6 +719,7 @@
submenus.append(submenu)
return submenus
+ # TODO the following two methods should move to GradingProjectSurvey
def activate(self, request, **kwargs):
"""This is a hack to support the 'Enable grades' button.
"""