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', ]