From 3adbd561ced57cb9c950af2d6d7d25f57f8799e0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 19 Mar 2025 11:54:38 +0100 Subject: 🚑️ fix huge performance problems on permissions when too many items are attached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_finds/models_finds.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'archaeological_finds/models_finds.py') diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 464076caf..78e1ec217 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -2972,20 +2972,25 @@ class Find( def _get_query_owns(cls, ishtaruser, prefix=""): q = ( cls._construct_query_own( - f"{prefix}container__location__", Warehouse._get_query_owns_dicts(ishtaruser) + cls, f"{prefix}container__location__", + Warehouse._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own( - f"{prefix}container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser) + cls, f"{prefix}container__responsible__", + Warehouse._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own( + cls, f"{prefix}base_finds__context_record__operation__", Operation._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, f"{prefix}basket__", [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}], ) | cls._construct_query_own( + cls, "", [ {f"{prefix}history_creator": ishtaruser.user_ptr}, -- cgit v1.2.3