(api) allow updating link configuration for a document

We open a specific endpoint to update documents link configuration
because it makes it more secure and simple to limit access rights
to administrators/owners whereas other document fields like title
and content can be edited by anonymous or authenticated users with
much less access rights.
This commit is contained in:
Samuel Paccoud - DINUM
2024-09-08 23:07:47 +02:00
committed by Samuel Paccoud
parent f5c4106547
commit 1e432cfdc2
6 changed files with 195 additions and 0 deletions

View File

@@ -512,6 +512,7 @@ class Document(BaseModel):
return {
"attachment_upload": is_owner_or_admin or is_editor,
"destroy": RoleChoices.OWNER in roles,
"link_configuration": is_owner_or_admin,
"manage_accesses": is_owner_or_admin,
"partial_update": is_owner_or_admin or is_editor,
"retrieve": can_get,