summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-10-16 17:57:13 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:43:48 +0100
commitc93dd3812c53d21ab8517dc7af72e1d4b70a1b04 (patch)
tree2153d8fd121f7ecd08a31e4867d58a2eb3c9aab7 /archaeological_context_records/models.py
parentb8eef9b6aaed7ee097f8ea86174067f9ca42abd8 (diff)
downloadIshtar-c93dd3812c53d21ab8517dc7af72e1d4b70a1b04.tar.bz2
Ishtar-c93dd3812c53d21ab8517dc7af72e1d4b70a1b04.zip
♻ permissions refactoring: refactor has_permission methods
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index ccc145c48..2611b7dfd 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -791,14 +791,20 @@ class ContextRecord(
icon_class="fa fa-lock",
text=_("Lock/Unlock"),
target="many",
- rights=["change_contextrecord", "change_own_contextrecord"],
+ rights=[
+ "archaeological_context_records.change_contextrecord",
+ "archaeological_context_records.change_own_contextrecord"
+ ],
)
QA_EDIT = QuickAction(
url="contextrecord-qa-bulk-update",
icon_class="fa fa-pencil",
text=_("Bulk update"),
target="many",
- rights=["change_contextrecord", "change_own_contextrecord"],
+ rights=[
+ "archaeological_context_records.change_contextrecord",
+ "archaeological_context_records.change_own_contextrecord"
+ ],
)
QUICK_ACTIONS = [
QA_EDIT,
@@ -808,7 +814,10 @@ class ContextRecord(
icon_class="fa fa-clone",
text=_("Duplicate"),
target="one",
- rights=["change_contextrecord", "change_own_contextrecord"],
+ rights=[
+ "archaeological_context_records.change_contextrecord",
+ "archaeological_context_records.change_own_contextrecord"
+ ],
),
]
SERIALIZE_EXCLUDE = MainItem.SERIALIZE_EXCLUDE + ["contextrecord"]
@@ -1159,12 +1168,15 @@ class ContextRecord(
actions = super().get_extra_actions(request)
is_locked = hasattr(self, "is_locked") and self.is_locked(request.user)
- can_edit_cr = self.can_do(request, "change_contextrecord")
+ can_edit_cr = self.can_do(
+ request, "archaeological_context_records.change_contextrecord"
+ )
profile = get_current_profile()
- can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata")
+ can_add_geo = profile.mapping and \
+ self.can_do(request, "ishtar_common.add_geovectordata")
if can_add_geo:
actions.append(self.get_add_geo_action())
- can_create_find = self.can_do(request, "add_find")
+ can_create_find = self.can_do(request, "archaeological_finds.add_find")
if can_create_find:
actions += [
(