Skip to content
Snippets Groups Projects
Verified Commit 52af5f8b authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add needed scopes to LiveDocumentShowAPIView

(cherry picked from commit ab4b4dcf)
parent 9eb7fdd9
No related branches found
No related tags found
No related merge requests found
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]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment