app/soc/views/helper/access.py
changeset 1200 e68fd70ba076
parent 1198 3318f8d00691
child 1201 0a4c1af700a0
--- a/app/soc/views/helper/access.py	Tue Feb 03 13:26:34 2009 +0000
+++ b/app/soc/views/helper/access.py	Tue Feb 03 13:27:52 2009 +0000
@@ -658,6 +658,34 @@
     new_args = {'scope_path': program.scope_path }
     self.checkHasRole(new_args, host_logic)
 
+
+  @allowDeveloper
+  def checkCanEditGroupApp(self, django_args, group_app_logic):
+    """Checks if the group_app in args is valid to be edited.
+
+    Args:
+      group_app_logic: A logic instance for the Group Application
+    """
+
+    self.checkIsUser(django_args)
+
+    fields = {
+        'link_id': django_args['link_id'],
+        'applicant': self.user,
+        'status' : ['needs review', 'rejected']
+        }
+
+    if 'scope_path' in django_args:
+      fields['scope_path'] = django_args['scope_path']
+
+    entity = group_app_logic.getForFields(fields)
+
+    if entity:
+      return
+
+    raise out_of_band.AccessViolation(message_fmt=DEF_NOT_YOUR_ENTITY_MSG)
+
+
   @allowDeveloper
   def checkIsApplicationAccepted(self, django_args, app_logic):
     """Returns an alternate HTTP response if Google Account has no Club App
@@ -702,6 +730,9 @@
         field_name: self.user if user else self.user.key().name()
         }
 
+    if 'scope_path' in django_args:
+      fields['scope_path'] = django_args['scope_path']
+
     entity = logic.getForFields(fields)
 
     if entity: