Beispiel #1
0
    def process_view(self, request, view_func, view_args, view_kwargs):
        pdp = getPDP()
        if pdp:
            try:
                authorized = pdp.authorize(request)
                message = "Not authorized"
                code = "AccessForbidden"
            except AuthorisationException as e:
                authorized = False
                message = str(e)
                code = e.code

            if not authorized:
                encoder = OWS20ExceptionXMLEncoder()
                return HttpResponse(encoder.serialize(
                    encoder.encode_exception(message, "2.0.0", code)),
                                    encoder.content_type,
                                    status=403)
Beispiel #2
0
    def wrapped(request, *args, **kwargs):
        pdp = getPDP()
        if pdp:
            try:
                authorized = pdp.authorize(request)
                message = "Not authorized"
                code = "NotAuthorized"
            except AuthorisationException, e:
                authorized = False
                message = str(e)
                code = e.code

            if not authorized:
                encoder = OWS20ExceptionXMLEncoder()
                return HttpResponse(encoder.serialize(
                    encoder.encode_exception(message, "2.0.0", code)),
                                    encoder.content_type,
                                    status=403)
Beispiel #3
0
    def wrapped(request, *args, **kwargs):
        pdp = getPDP()
        if pdp:
            try:
                authorized = pdp.authorize(request)
                message = "Not authorized"
                code = "NotAuthorized"
            except AuthorisationException, e:
                authorized = False
                message = str(e)
                code = e.code

            if not authorized:
                encoder = OWS20ExceptionXMLEncoder()
                return HttpResponse(
                    encoder.serialize(
                        encoder.encode_exception(message, "2.0.0", code)
                    ),
                    encoder.content_type, status=403
                )
Beispiel #4
0
    def process_view(self, request, view_func, view_args, view_kwargs):
        pdp = getPDP()
        if pdp:
            try:
                authorized = pdp.authorize(request)
                message = "Not authorized"
                code = "AccessForbidden"
            except AuthorisationException, e:
                authorized = False
                message = str(e)
                code = e.code

            if not authorized:
                encoder = OWS20ExceptionXMLEncoder()
                return HttpResponse(
                    encoder.serialize(
                        encoder.encode_exception(message, "2.0.0", code)
                    ),
                    encoder.content_type, status=403
                )