Add a simple access check for a picker
The picker page should not be accessible if the required GET args are
not present.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/access.py Fri Jan 23 17:51:35 2009 +0000
+++ b/app/soc/views/helper/access.py Fri Jan 23 21:04:45 2009 +0000
@@ -680,6 +680,27 @@
checkAccess(access_type, request, rights=params['rights'])
+def checkHasPickGetArgs(request, arg, kwargs):
+ """Raises an alternate HTTP response if the request misses get args
+
+ Args:
+ request: a Django HTTP request
+
+ Raises:
+ AccessViolationResponse:
+ * if continue is not in request.GET
+ * if field is not in request.GET
+ """
+
+ get_args = request.GET
+
+ if 'continue' in get_args and 'field' in get_args:
+ return
+
+ #TODO(SRabbelier) inform user that return_url and field are required
+ deny(request, arg, kwargs)
+
+
def checkIsDocumentPublic(request, args, kwargs):
"""Checks whether a document is public.