def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
             and not user_can_see_query(request, kwargs)\
             and not (app_settings.EXPLORER_TOKEN_AUTH_ENABLED()
                      and request.META.get('HTTP_X_API_TOKEN') == app_settings.EXPLORER_TOKEN):
         return safe_login_prompt(request)
     return f(request, *args, **kwargs)
Example #2
0
 def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_CHANGE(request.user):
         return safe_login_prompt(request)
     return f(request, *args, **kwargs)
Example #3
0
 def handle_no_permission(self, request):
     return safe_login_prompt(request)
 def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
             and not allowed_query_pks(request.user.id):
         return safe_login_prompt(request)
     return f(request, *args, **kwargs)
Example #5
0
 def handle_no_permission(self, request):
     if django.VERSION >= (1, 11):
         return SafeLoginView.as_view(
             extra_context={'title': 'Log in', REDIRECT_FIELD_NAME: request.get_full_path()})(request)
     return safe_login_prompt(request)