Skip to content

Commit

Permalink
Fix permissions issue
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjgeiger committed May 16, 2024
1 parent 4ce0b5b commit 0237813
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/preprints/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
"""
Expand All @@ -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*
Expand Down

0 comments on commit 0237813

Please sign in to comment.