(backend) add duplicate action to the document API endpoint

We took this opportunity to refactor the way access is controlled on
media attachments. We now add the media key to a list on the document
instance each time a media is uploaded to a document. This list is
passed along when a document is duplicated, allowing us to grant
access to readers on the new document, even if they don't have or
lost access to the original document.

We also propose an option to reproduce the same access rights on the
duplicate document as what was in place on the original document.
This can be requested by passing the "with_accesses=true" option in
the query string.

The tricky point is that we need to extract attachment keys from the
existing documents and set them on the new "attachments" field that is
now used to track access rights on media files.
This commit is contained in:
Samuel Paccoud - DINUM
2025-01-20 10:23:18 +01:00
committed by Manuel Raynaud
parent 6976bb7c78
commit 34a208a80d
19 changed files with 1066 additions and 79 deletions

View File

@@ -57,13 +57,8 @@ dependencies = [
"requests==2.32.3",
"sentry-sdk==2.24.0",
"url-normalize==1.4.3",
<<<<<<< HEAD
"whitenoise==6.9.0",
"mozilla-django-oidc==4.0.1",
=======
"whitenoise==6.8.2",
"y-py==0.6.2",
>>>>>>> f087cd70 ((backend) add util to extract text from Ydoc content)
]
[project.urls]