From c93dd3812c53d21ab8517dc7af72e1d4b70a1b04 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 16 Oct 2024 17:57:13 +0200 Subject: ♻ permissions refactoring: refactor has_permission methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_context_records/urls.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'archaeological_context_records/urls.py') diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py index 2b95db086..338f5bb2a 100644 --- a/archaeological_context_records/urls.py +++ b/archaeological_context_records/urls.py @@ -20,38 +20,42 @@ from django.conf.urls import url from django.urls import path -from ishtar_common.utils import check_rights +from ishtar_common.utils import check_permissions from archaeological_context_records import models, views, views_api -# be careful: each check_rights must be relevant with ishtar_menu +# be careful: each check_permissions must be relevant with ishtar_menu # forms urlpatterns = [ # Context records url( r"record_search/(?P.+)?$", - check_rights(["view_contextrecord", "view_own_contextrecord"])( + check_permissions(["archaeological_context_records.view_contextrecord", + "archaeological_context_records.view_own_contextrecord"])( views.record_search_wizard ), name="record_search", ), url( r"contextrecord_search/(?P.+)?$", - check_rights(["view_contextrecord", "view_own_contextrecord"])( + check_permissions(["archaeological_context_records.view_contextrecord", + "archaeological_context_records.view_own_contextrecord"])( views.record_search_wizard ), name="contextrecord_search", ), url( r"record_creation/(?P.+)?$", - check_rights(["add_contextrecord", "add_own_contextrecord"])( + check_permissions(["archaeological_context_records.add_contextrecord", + "archaeological_context_records.add_own_contextrecord"])( views.record_creation_wizard ), name="record_creation", ), url( r"record_modification/(?P.+)?$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.record_modification_wizard ), name="record_modification", @@ -59,7 +63,8 @@ urlpatterns = [ url(r"record_modify/(?P.+)/$", views.record_modify, name="record_modify"), url( r"record_deletion/(?P.+)?$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.record_deletion_wizard ), name="record_deletion", @@ -151,14 +156,16 @@ urlpatterns = [ ), url( r"^context-record-relations-modify/(?P.+)/$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.context_record_modify_relations ), name="context-record-relation-modify", ), url( r"^operation-qa-contextrecord/(?P[0-9]+)/$", - check_rights(["add_contextrecord", "add_own_contextrecord"])( + check_permissions(["archaeological_context_records.add_contextrecord", + "archaeological_context_records.add_own_contextrecord"])( views.QAOperationContextRecordView.as_view() ), name="operation-qa-contextrecord", @@ -171,21 +178,24 @@ urlpatterns = [ ), url( r"^contextrecord-qa-duplicate/(?P[0-9-]+)?/$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.QAContextRecordDuplicateFormView.as_view() ), name="contextrecord-qa-duplicate", ), url( r"^contextrecord-qa-bulk-update/(?P[0-9-]+)?/$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.QAContextRecordForm.as_view() ), name="contextrecord-qa-bulk-update", ), url( r"^contextrecord-qa-bulk-update/(?P[0-9-]+)?/confirm/$", - check_rights(["change_contextrecord", "change_own_contextrecord"])( + check_permissions(["archaeological_context_records.change_contextrecord", + "archaeological_context_records.change_own_contextrecord"])( views.QAContextRecordForm.as_view() ), name="contextrecord-qa-bulk-update-confirm", -- cgit v1.2.3