Exemplo n.º 1
0
        def can_access_report(request, report, **kwargs):
            rep = get_object_or_404(Report, slug=report)
            if not _has_access(request, rep):
                return ForbiddenResponse(request)
            if needs_privacy_signature(request):
                return privacy_redirect(request)

            request.report = rep # no need to re-fetch it later
            return view_func(request=request, report=report, **kwargs)
Exemplo n.º 2
0
        def can_access_report(request, report, **kwargs):
            rep = get_object_or_404(Report, slug=report)
            if not _has_access(request, rep):
                return ForbiddenResponse(request)
            if needs_privacy_signature(request):
                return privacy_redirect(request)

            request.report = rep # no need to re-fetch it later
            return view_func(request=request, report=report, **kwargs)
Exemplo n.º 3
0
 def wrapper(request, *args, **kwargs):
     if test_func(request, **kwargs):
         if needs_privacy_signature(request, only_relevant_roles=not force_privacy):
             # logic there: usually only check for the admin roles we know have a privacy implication. If we're
             # passed force_privacy, then views must have the privacy agreement.
             return privacy_redirect(request)
         else:
             return view_func(request, *args, **kwargs)
     elif request.user.is_authenticated():
         return ForbiddenResponse(request)
     else:
         path = '%s?%s=%s' % (login_url, redirect_field_name,
                              urlquote(request.get_full_path()))
         return HttpResponseRedirect(path)
Exemplo n.º 4
0
 def wrapper(request, *args, **kwargs):
     if test_func(request, **kwargs):
         if needs_privacy_signature(
                 request, only_relevant_roles=not force_privacy):
             # logic there: usually only check for the admin roles we know have a privacy implication. If we're
             # passed force_privacy, then views must have the privacy agreement.
             return privacy_redirect(request)
         else:
             return view_func(request, *args, **kwargs)
     elif request.user.is_authenticated():
         return ForbiddenResponse(request)
     else:
         path = '%s?%s=%s' % (login_url, redirect_field_name,
                              urlquote(request.get_full_path()))
         return HttpResponseRedirect(path)