# HG changeset patch # User Lennard de Rijk # Date 1246283073 -7200 # Node ID dae6715a2f19d2851f0ea7c47560eb865fe159eb # Parent 0cf8f034f52dcf78f152e100339219fcd4584c01 Prepared Survey access controls to deal with multiple logics. Also added a TODO to move a method to another view. diff -r 0cf8f034f52d -r dae6715a2f19 app/soc/views/helper/access.py --- 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: diff -r 0cf8f034f52d -r dae6715a2f19 app/soc/views/models/survey.py --- 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. """