diff --git a/aleksis/apps/resint/views.py b/aleksis/apps/resint/views.py index fcc50f0b31126a312e40e117b17d2f120b6acecb..50bfdf65fe59ee1bfe7bd33527dcb6c3a60bd691 100644 --- a/aleksis/apps/resint/views.py +++ b/aleksis/apps/resint/views.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, Type +from typing import Any, Dict, List, Type from django.contrib.contenttypes.models import ContentType from django.db.models import QuerySet @@ -15,7 +15,7 @@ from django.views.generic.list import ListView from django_tables2 import SingleTableView from guardian.shortcuts import get_objects_for_user -from oauth2_provider.views.mixins import ClientProtectedResourceMixin +from oauth2_provider.views.mixins import ClientProtectedResourceMixin, ScopedResourceMixin from reversion.views import RevisionMixin from rules.contrib.views import PermissionRequiredMixin @@ -241,5 +241,11 @@ class LiveDocumentShowView(PermissionRequiredMixin, LiveDocumentShowBaseView): permission_required = "resint.view_livedocument_rule" -class LiveDocumentShowAPIView(ClientProtectedResourceMixin, LiveDocumentShowBaseView): +class LiveDocumentShowAPIView( + ScopedResourceMixin, ClientProtectedResourceMixin, LiveDocumentShowBaseView +): """Show the current version of the live document in API.""" + + def get_scopes(self, *args, **kwargs) -> List[str]: + """Return the scope needed to access the PDF file.""" + return [self.get_object().scope]