Fix: respect model permissions for ui_settings API endpoint

This commit is contained in:
shamoon 2024-06-11 01:00:10 -07:00
parent f225f72145
commit b6f6d524d6

View File

@ -61,7 +61,6 @@ from rest_framework.mixins import DestroyModelMixin
from rest_framework.mixins import ListModelMixin
from rest_framework.mixins import RetrieveModelMixin
from rest_framework.mixins import UpdateModelMixin
from rest_framework.permissions import DjangoModelPermissions
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
@ -1540,14 +1539,9 @@ class StoragePathViewSet(ModelViewSet, PermissionsAwareDocumentCountMixin):
class UiSettingsView(GenericAPIView):
queryset = UiSettings.objects.all()
permission_classes = (IsAuthenticated, DjangoModelPermissions)
permission_classes = (IsAuthenticated, PaperlessObjectPermissions)
serializer_class = UiSettingsViewSerializer
perms_map = {
"GET": ["%(app_label)s.view_%(model_name)s"],
"POST": ["%(app_label)s.change_%(model_name)s"],
}
def get(self, request, format=None):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)