# HG changeset patch # User Sverre Rabbelier # Date 1232744685 0 # Node ID 1131884c3c56ee9613c24c2db3b006dc6f69c536 # Parent 7e88fba647b15cb4b1a7a217e1fbf8e28988d55e 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 diff -r 7e88fba647b1 -r 1131884c3c56 app/soc/views/helper/access.py --- 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.