summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-27 15:23:50 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-27 16:50:35 +0100
commit4566c05ecafbba8c89e0a5f343742ad8862e41ad (patch)
treeb54435dff93d340bcd80dbfbdff72387a7a35cd7 /archaeological_finds
parentdccd9e59f3385809e51d30f56306f1e96aa99437 (diff)
downloadIshtar-4566c05ecafbba8c89e0a5f343742ad8862e41ad.tar.bz2
Ishtar-4566c05ecafbba8c89e0a5f343742ad8862e41ad.zip
🐛 Fix consultation permissions on the contents of a container (#5767)
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_finds.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 680c954ee..e331c90a3 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -2921,33 +2921,37 @@ class Find(
return new
@classmethod
- def get_query_owns(cls, ishtaruser):
+ def _get_query_owns(cls, ishtaruser, prefix=""):
q = (
cls._construct_query_own(
- "container__location__", Warehouse._get_query_owns_dicts(ishtaruser)
+ f"{prefix}container__location__", Warehouse._get_query_owns_dicts(ishtaruser)
)
| cls._construct_query_own(
- "container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser)
+ f"{prefix}container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser)
)
| cls._construct_query_own(
- "base_finds__context_record__operation__",
+ f"{prefix}base_finds__context_record__operation__",
Operation._get_query_owns_dicts(ishtaruser),
)
| cls._construct_query_own(
- "basket__",
+ f"{prefix}basket__",
[{"shared_with": ishtaruser, "shared_write_with": ishtaruser}],
)
| cls._construct_query_own(
"",
[
- {"history_creator": ishtaruser.user_ptr},
- {"base_finds__context_record__operation__end_date__isnull": True},
+ {f"{prefix}history_creator": ishtaruser.user_ptr},
+ {f"{prefix}base_finds__context_record__operation__end_date__isnull": True},
],
)
)
return q
@classmethod
+ def get_query_owns(cls, ishtaruser):
+ return cls._get_query_owns(ishtaruser)
+
+ @classmethod
def get_owns(
cls, user, menu_filtr=None, limit=None, values=None, get_short_menu_class=None
):
@@ -3533,6 +3537,10 @@ class FindInsideContainer(models.Model):
managed = False
db_table = "find_inside_container"
+ @classmethod
+ def get_query_owns(cls, ishtaruser):
+ return Find._get_query_owns(ishtaruser, prefix="find__")
+
for attr in Find.HISTORICAL_M2M:
m2m_changed.connect(m2m_historization_changed, sender=getattr(Find, attr).through)