Allow staff to view unrestricted document requests endpoint

This commit is contained in:
Keannu Bernasol 2024-11-28 17:12:38 +08:00
parent 776c3e08e1
commit 98e12dd15e

View file

@ -1,7 +1,7 @@
from rest_framework import generics from rest_framework import generics
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
from rest_framework.pagination import PageNumberPagination from rest_framework.pagination import PageNumberPagination
from accounts.permissions import IsHead from accounts.permissions import IsHead, IsStaff
from rest_framework.pagination import PageNumberPagination from rest_framework.pagination import PageNumberPagination
from .serializers import ( from .serializers import (
DocumentRequestCreationSerializer, DocumentRequestCreationSerializer,
@ -45,13 +45,13 @@ class DocumentRequestListView(generics.ListAPIView):
class DocumentRequestFullListView(generics.ListAPIView): class DocumentRequestFullListView(generics.ListAPIView):
""" """
Returns document requests. Always returns the link to download the document. Returns document requests. Always returns the link to download the document.
Head is able to view all document requests here. Staff and clients have no access Head is able to view all document requests here. Clients have no access, only staff.
""" """
http_method_names = ["get"] http_method_names = ["get"]
serializer_class = DocumentRequestSerializer serializer_class = DocumentRequestSerializer
pagination_class = PageNumberPagination pagination_class = PageNumberPagination
permission_classes = [IsAuthenticated, IsHead] permission_classes = [IsAuthenticated, IsStaff]
queryset = DocumentRequest.objects.all() queryset = DocumentRequest.objects.all()