From 68c572bd6ef9f8f06c7fb7b7d8cfc24025b86a8d Mon Sep 17 00:00:00 2001 From: Michael Price Date: Thu, 22 Feb 2018 02:44:36 -0400 Subject: [PATCH] Require the document view permission to view the details of a trashed document. Add a get method override to document the API endpoint. Signed-off-by: Michael Price --- mayan/apps/documents/api_views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mayan/apps/documents/api_views.py b/mayan/apps/documents/api_views.py index 10640e26fc..1b3923351d 100644 --- a/mayan/apps/documents/api_views.py +++ b/mayan/apps/documents/api_views.py @@ -57,7 +57,8 @@ class APIDeletedDocumentView(generics.RetrieveDestroyAPIView): """ mayan_object_permissions = { - 'DELETE': (permission_document_delete,) + 'DELETE': (permission_document_delete,), + 'GET': (permission_document_view,) } permission_classes = (MayanPermission,) queryset = Document.trash.all() @@ -70,6 +71,13 @@ class APIDeletedDocumentView(generics.RetrieveDestroyAPIView): return super(APIDeletedDocumentView, self).delete(*args, **kwargs) + def get(self, *args, **kwargs): + """ + Retreive the details of the trashed document. + """ + + return super(APIDeletedDocumentView, self).get(*args, **kwargs) + class APIDeletedDocumentRestoreView(generics.GenericAPIView): """