def map_permissions_check(view_func):
@wraps(view_func)<EOL>def wrapper(request, *args, **kwargs):<EOL><INDENT>map_inst = get_object_or_404(Map, pk=kwargs['<STR_LIT>'])<EOL>user = request.user<EOL>kwargs['<STR_LIT>'] = map_inst  <EOL>if map_inst.edit_status >= map_inst.EDITORS:<EOL><INDENT>can_edit = map_inst.can_edit(user=user, request=request)<EOL>if not can_edit:<EOL><INDENT>if map_inst.owner and not user.is_authenticated():<EOL><INDENT>return simple_json_response(login_required=str(LOGIN_URL))<EOL><DEDENT>else:<EOL><INDENT>return HttpResponseForbidden('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>return view_func(request, *args, **kwargs)<EOL><DEDENT>return wrapper<EOL>
Used for URLs dealing with the map.