🛂(back) restrict ask for access to root documents

In a first version we want to restrict the ask for access feature only
to root document. We will work on opening to all documents when iherited
permissions will be implemented.
This commit is contained in:
Manuel Raynaud
2025-07-08 10:58:48 +02:00
committed by Anthony LC
parent 82f2cb59e6
commit 95838e332c
2 changed files with 117 additions and 2 deletions

View File

@@ -1910,7 +1910,8 @@ class DocumentAskForAccessViewSet(
if self._document is None:
try:
self._document = models.Document.objects.get(
pk=self.kwargs["resource_id"]
pk=self.kwargs["resource_id"],
depth=1,
)
except models.Document.DoesNotExist as e:
raise drf.exceptions.NotFound("Document not found.") from e