From 64b7644e5e25a22f9f09ba153bd11cb0c1676c02 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 24 Mar 2024 10:47:35 +0100 Subject: [PATCH] Admin users can manage juries Signed-off-by: Emmy D'Anello --- registration/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registration/api/views.py b/registration/api/views.py index 06fa574..acddd58 100644 --- a/registration/api/views.py +++ b/registration/api/views.py @@ -4,7 +4,7 @@ from django.contrib.auth.models import User from django_filters.rest_framework import DjangoFilterBackend from rest_framework.filters import SearchFilter -from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS +from rest_framework.permissions import BasePermission, IsAdminUser, IsAuthenticated, SAFE_METHODS from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet from .serializers import BasicUserSerializer, PaymentSerializer, RegistrationSerializer @@ -34,7 +34,7 @@ class IsTournamentOrganizer(BasePermission): class VolunteersViewSet(ReadOnlyModelViewSet): queryset = User.objects.filter(registration__volunteerregistration__isnull=False) serializer_class = BasicUserSerializer - permission_classes = [IsAuthenticated & IsTournamentOrganizer] + permission_classes = [IsAdminUser | (IsAuthenticated & IsTournamentOrganizer)] filter_backends = [DjangoFilterBackend, SearchFilter] filterset_fields = ['first_name', 'last_name', 'email', ] search_fields = ['$first_name', '$last_name', '$email', ]