1111from api .base .parsers import JSONAPIMultipleRelationshipsParser , JSONAPIMultipleRelationshipsParserForRegularJSON
1212
1313from api .base .views import JSONAPIBaseView
14- from api .base .views import BaseLinkedList
1514from api .base .views import LinkedNodesRelationship
1615from api .nodes .utils import NodeOptimizationMixin
1716
@@ -507,7 +506,7 @@ def get_resource(self, check_object_permissions=True):
507506 return self .get_collection_submission (check_object_permissions )
508507
509508
510- class LinkedNodesList (BaseLinkedList , CollectionMixin , NodeOptimizationMixin ):
509+ class LinkedNodesList (JSONAPIBaseView , generics . ListAPIView , CollectionMixin , NodeOptimizationMixin ):
511510 """List of nodes linked to this node. *Read-only*.
512511
513512 Linked nodes are the project/component nodes pointed to by node links. This view will probably replace node_links in the near future.
@@ -560,6 +559,10 @@ class LinkedNodesList(BaseLinkedList, CollectionMixin, NodeOptimizationMixin):
560559 CollectionWriteOrPublic ,
561560 base_permissions .TokenHasScope ,
562561 )
562+
563+ required_read_scopes = [CoreScopes .COLLECTED_META_READ ]
564+ required_write_scopes = [CoreScopes .COLLECTED_META_WRITE ]
565+
563566 serializer_class = NodeSerializer
564567 view_category = 'collections'
565568 view_name = 'linked-nodes'
@@ -582,7 +585,7 @@ def get_parser_context(self, http_request):
582585 return res
583586
584587
585- class LinkedRegistrationsList (BaseLinkedList , CollectionMixin ):
588+ class LinkedRegistrationsList (JSONAPIBaseView , generics . ListAPIView , CollectionMixin ):
586589 """List of registrations linked to this node. *Read-only*.
587590
588591 Linked registrations are the registration nodes pointed to by node links.
@@ -656,11 +659,22 @@ class LinkedRegistrationsList(BaseLinkedList, CollectionMixin):
656659 view_category = 'collections'
657660 view_name = 'linked-registrations'
658661
662+ required_read_scopes = [CoreScopes .COLLECTED_META_READ ]
663+ required_write_scopes = [CoreScopes .COLLECTED_META_WRITE ]
664+
659665 ordering = ('-modified' ,)
660666
661667 def get_queryset (self ):
662668 auth = get_user_auth (self .request )
663- return Registration .objects .filter (guids__in = self .get_collection ().active_guids .all (), is_deleted = False ).can_view (user = auth .user , private_link = auth .private_link ).order_by ('-modified' )
669+ return Registration .objects .filter (
670+ guids__in = self .get_collection ().active_guids .all (),
671+ is_deleted = False ,
672+ ).can_view (
673+ user = auth .user ,
674+ private_link = auth .private_link ,
675+ ).order_by (
676+ '-modified' ,
677+ )
664678
665679 # overrides APIView
666680 def get_parser_context (self , http_request ):
@@ -672,7 +686,7 @@ def get_parser_context(self, http_request):
672686 return res
673687
674688
675- class LinkedPreprintsList (BaseLinkedList , CollectionMixin ):
689+ class LinkedPreprintsList (JSONAPIBaseView , generics . ListAPIView , CollectionMixin ):
676690 """List of preprints linked to this collection. *Read-only*.
677691 """
678692 permission_classes = (
@@ -684,6 +698,9 @@ class LinkedPreprintsList(BaseLinkedList, CollectionMixin):
684698 view_category = 'collections'
685699 view_name = 'linked-preprints'
686700
701+ required_read_scopes = [CoreScopes .COLLECTED_META_READ ]
702+ required_write_scopes = [CoreScopes .COLLECTED_META_WRITE ]
703+
687704 ordering = ('-modified' ,)
688705
689706 def get_queryset (self ):
0 commit comments