From 7bc060988d156f827fc8d5814df6e865cf96b142 Mon Sep 17 00:00:00 2001 From: Samuel Paccoud - DINUM Date: Fri, 25 Apr 2025 08:03:12 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(backend)=20simplify=20roles?= =?UTF-8?q?=20by=20returning=20only=20the=20max=20role?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were returning the list of roles a user has on a document (direct and inherited). Now that we introduced priority on roles, we are able to determine what is the max role and return only this one. This commit also changes the role that is returned for the restricted reach: we now return None because the role is not relevant in this case. --- src/backend/core/models.py | 2 +- src/backend/core/tests/documents/test_api_documents_trashbin.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/core/models.py b/src/backend/core/models.py index c48af63e..5c2172fd 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -664,7 +664,7 @@ class Document(MP_Node, BaseModel): @property def ancestors_link_definition(self): - """Link defintion equivalent to all document's ancestors.""" + """Link definition equivalent to all document's ancestors.""" if getattr(self, "_ancestors_link_definition", None) is None: if self.depth <= 1: ancestors_links = [] diff --git a/src/backend/core/tests/documents/test_api_documents_trashbin.py b/src/backend/core/tests/documents/test_api_documents_trashbin.py index 3a0a5f56..9e805397 100644 --- a/src/backend/core/tests/documents/test_api_documents_trashbin.py +++ b/src/backend/core/tests/documents/test_api_documents_trashbin.py @@ -74,7 +74,6 @@ def test_api_documents_trashbin_format(): "accesses_view": True, "ai_transform": True, "ai_translate": True, - "ancestors_links_definitions": {}, "attachment_upload": True, "can_edit": True, "children_create": True,