Fixed club_app
The user could not edit their own club app due to a buggy check.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/access.py Mon Feb 02 14:47:09 2009 +0000
+++ b/app/soc/views/helper/access.py Mon Feb 02 15:00:43 2009 +0000
@@ -674,7 +674,8 @@
# TODO(srabbelier) Make this give a proper error message
self.deny(django_args)
- def checkIsMyEntity(self, django_args, logic, field_name='user'):
+ def checkIsMyEntity(self, django_args, logic,
+ field_name='user', user=False):
"""Checks whether the entity belongs to the user.
"""
@@ -682,7 +683,7 @@
fields = {
'link_id': django_args['link_id'],
- field_name: self.user.key().name(),
+ field_name: self.user if user else self.user.key().name()
}
entity = logic.getForFields(fields)
--- a/app/soc/views/models/club_app.py Mon Feb 02 14:47:09 2009 +0000
+++ b/app/soc/views/models/club_app.py Mon Feb 02 15:00:43 2009 +0000
@@ -50,10 +50,13 @@
rights = access.Checker(params)
rights['create'] = ['checkIsUser']
- rights['delete'] = [('checkIsMyEntity', [club_app_logic.logic, 'applicant'])]
- rights['edit'] = [('checkIsMyEntity', [club_app_logic.logic, 'applicant'])]
+ rights['delete'] = [('checkIsMyEntity',
+ [club_app_logic.logic, 'applicant', True])]
+ rights['edit'] = [('checkIsMyEntity',
+ [club_app_logic.logic, 'applicant', True])]
rights['list'] = ['checkIsUser']
- rights['public'] = [('checkIsMyEntity', [club_app_logic.logic, 'applicant'])]
+ rights['public'] = [('checkIsMyEntity',
+ [club_app_logic.logic, 'applicant', True])]
rights['review'] = [('checkHasRole', host_logic.logic)]
new_params = {}