From ce7d642318f4e4c57dd552915b12eef360d33d70 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 7 Nov 2024 17:31:57 +0100 Subject: ✨ permissions refactoring: settings for upstream items management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_operations/models.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index dd265fb1d..3f4f252c3 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -447,6 +447,10 @@ class ArchaeologicalSite( "documents__associated_file__isnull", "documents__associated_url__isnull", ] + UPPER_PERMISSIONS = [ + (("archaeological_operations", "operation"), + "operations__pk"), + ] ALT_NAMES = { "reference": SearchAltName( pgettext_lazy("key for text search", "reference"), "reference__iexact" @@ -1321,6 +1325,10 @@ class Operation( "cached_remains", "cached_label", ] + UPPER_PERMISSIONS = [ + (("archaeological_files", "file"), + "associated_file_id"), + ] objects = UUIDModelManager() # alternative names of fields for searches @@ -2825,7 +2833,8 @@ post_save.connect(post_save_cache, sender=ActType) post_delete.connect(post_save_cache, sender=ActType) -class AdministrativeAct(DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter, SheetItem): +class AdministrativeAct(DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter, + SheetItem): SHOW_URL = "show-administrativeact" TABLE_COLS = [ "full_ref", @@ -3068,6 +3077,16 @@ class AdministrativeAct(DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter, "operation__towns__numero_insee__startswith": "_get_department_code", "associated_file__towns__numero_insee__startswith": "_get_department_code", } + UPPER_PERMISSIONS = [ + (("archaeological_operations", "operation"), + "operation_id"), + (("archaeological_files", "file"), + "associated_file_id"), + (("archaeological_finds", "treatmentfile"), + "treatment_file_id"), + (("archaeological_finds", "treatment"), + "treatment_id"), + ] # fields act_type = models.ForeignKey( -- cgit v1.2.3