policies: improve logging

This commit is contained in:
Jens Langhammer 2021-03-02 15:04:31 +01:00
parent de03ed0aec
commit 743aaea15e
2 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from rest_framework.response import Response
class Pagination(pagination.PageNumberPagination):
"""Pagination which includes total pages and current page"""
page_query_param = "page"
page_size_query_param = "page_size"
def get_paginated_response(self, data):

View File

@ -63,10 +63,12 @@ class PolicyAccessView(AccessMixin, View):
try:
self.resolve_provider_application()
except (Application.DoesNotExist, Provider.DoesNotExist):
LOGGER.warning("failed to resolve application")
return self.handle_no_permission_authenticated()
# Check if user is unauthenticated, so we pass the application
# for the identification stage
if not request.user.is_authenticated:
LOGGER.warning("user not authenticated")
return self.handle_no_permission()
# Check permissions
result = self.user_has_access()