From 023781303af8d5d2a4f5d87021dbb1c2da905df7 Mon Sep 17 00:00:00 2001 From: "Brian J. Geiger" Date: Thu, 16 May 2024 14:59:36 -0400 Subject: [PATCH] Fix permissions issue --- api/preprints/views.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/preprints/views.py b/api/preprints/views.py index 4cfa6f51e0a..d5104494bae 100644 --- a/api/preprints/views.py +++ b/api/preprints/views.py @@ -456,6 +456,7 @@ class PreprintSubjectsList(BaseResourceSubjectsList, PreprintMixin): def get_resource(self): return self.get_preprint() + class PreprintSubjectsRelationship(SubjectRelationshipBaseView, PreprintMixin): """The documentation for this endpoint can be found [here](https://developer.osf.io/#operation/preprint_subjects_list). """ @@ -475,6 +476,16 @@ class PreprintSubjectsRelationship(SubjectRelationshipBaseView, PreprintMixin): def get_resource(self, check_object_permissions=True): return self.get_preprint(check_object_permissions=check_object_permissions) + def get_object(self): + resource = self.get_resource(check_object_permissions=False) + obj = { + 'data': resource.subjects.all(), + 'self': resource, + } + self.check_object_permissions(self.request, resource) + return obj + + class PreprintActionList(JSONAPIBaseView, generics.ListCreateAPIView, ListFilterMixin, PreprintMixin): """Action List *Read-only*