From 21ade649057974fa726904306cbe3e6baeac9a9d Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Thu, 31 Oct 2024 13:36:47 +0100 Subject: [PATCH] fix: DRF authentication methods in settings --- uniticket/api_rest/views/generic.py | 8 ++++---- uniticket/api_rest/views/manager.py | 1 - uniticket/api_rest/views/operator.py | 1 - uniticket/api_rest/views/user.py | 1 - uniticket/uni_ticket_project/settingslocal.py.example | 4 ++++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/uniticket/api_rest/views/generic.py b/uniticket/api_rest/views/generic.py index 3e454cd8..b42c2d3b 100644 --- a/uniticket/api_rest/views/generic.py +++ b/uniticket/api_rest/views/generic.py @@ -56,7 +56,7 @@ class GroupViewSet(viewsets.ModelViewSet): class uniTicketROGenericList(generics.ListAPIView): - authentication_classes = [AuthorizationToken, SessionAuthentication] + # authentication_classes = [AuthorizationToken, SessionAuthentication] permission_classes = [permissions.IsAuthenticated] @@ -71,9 +71,9 @@ class TicketAPIBaseView(APIView): """ # TODO: AgID MoDI also here? - authentication_classes = [ - AuthorizationToken, SessionAuthentication - ] + # authentication_classes = [ + # AuthorizationToken, SessionAuthentication + # ] permission_classes = [permissions.IsAuthenticated] def get_messages(self): diff --git a/uniticket/api_rest/views/manager.py b/uniticket/api_rest/views/manager.py index 2416a3da..c79f721c 100644 --- a/uniticket/api_rest/views/manager.py +++ b/uniticket/api_rest/views/manager.py @@ -17,7 +17,6 @@ from uni_ticket.utils import user_is_manager, user_is_operator, visible_tickets_to_user from organizational_area.models import OrganizationalStructure -from api_rest.authorizations import AuthorizationToken from . generic import * diff --git a/uniticket/api_rest/views/operator.py b/uniticket/api_rest/views/operator.py index 4fe68bbe..45b9b6ca 100644 --- a/uniticket/api_rest/views/operator.py +++ b/uniticket/api_rest/views/operator.py @@ -17,7 +17,6 @@ from uni_ticket.utils import user_is_manager, user_is_operator, visible_tickets_to_user from organizational_area.models import OrganizationalStructure -from api_rest.authorizations import AuthorizationToken from . generic import * diff --git a/uniticket/api_rest/views/user.py b/uniticket/api_rest/views/user.py index 8f0d8288..6d769f79 100644 --- a/uniticket/api_rest/views/user.py +++ b/uniticket/api_rest/views/user.py @@ -25,7 +25,6 @@ from uni_ticket.utils import user_is_manager, user_is_operator, visible_tickets_to_user from organizational_area.models import OrganizationalStructure -from api_rest.authorizations import AuthorizationToken from .. serializers import ( GroupSerializer, diff --git a/uniticket/uni_ticket_project/settingslocal.py.example b/uniticket/uni_ticket_project/settingslocal.py.example index d4f29034..8795bf0f 100644 --- a/uniticket/uni_ticket_project/settingslocal.py.example +++ b/uniticket/uni_ticket_project/settingslocal.py.example @@ -228,6 +228,10 @@ INTERNAL_IPS = ( ) REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.TokenAuthentication', + ], 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticated' ],