summaryrefslogtreecommitdiff
path: root/archaeological_finds/urls.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_finds/urls.py
parentb8eef9b6aaed7ee097f8ea86174067f9ca42abd8 (diff)
downloadIshtar-c93dd3812c53d21ab8517dc7af72e1d4b70a1b04.tar.bz2
Ishtar-c93dd3812c53d21ab8517dc7af72e1d4b70a1b04.zip
♻ permissions refactoring: refactor has_permission methods
Diffstat (limited to 'archaeological_finds/urls.py')
-rw-r--r--archaeological_finds/urls.py288
1 files changed, 174 insertions, 114 deletions
diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py
index a1b240363..ba10750d2 100644
--- a/archaeological_finds/urls.py
+++ b/archaeological_finds/urls.py
@@ -20,47 +20,56 @@
from django.conf.urls import url
from django.urls import path
-from ishtar_common.utils import check_rights, get_urls_for_model
+from ishtar_common.utils import check_permissions, get_urls_for_model
from archaeological_finds import views
from archaeological_finds import views_api
from archaeological_operations.views import administrativeactfile_document
from archaeological_finds import models
-# be careful: each check_rights must be relevant with ishtar_menu
+# be careful: each check_permissions must be relevant with ishtar_menu
# forms
urlpatterns = [
url(
r"find_search/(?P<step>.+)?$",
- check_rights(["view_find", "view_own_find"])(views.find_search_wizard),
+ check_permissions(
+ ["archaeological_finds.view_find", "archaeological_finds.view_own_find"]
+ )(views.find_search_wizard),
name="find_search",
),
url(
r"find_creation/(?P<step>.+)?$",
- check_rights(["add_find", "add_own_find"])(views.find_creation_wizard),
+ check_permissions(
+ ["archaeological_finds.add_find", "archaeological_finds.add_own_find"]
+ )(views.find_creation_wizard),
name="find_creation",
),
url(
r"find_modification/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.find_modification_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.find_modification_wizard),
name="find_modification",
),
url(r"find_modify/(?P<pk>.+)/$", views.find_modify, name="find_modify"),
url(r"find_create/(?P<pk>.+)/$", views.find_create, name="find_create"),
url(
r"find_deletion/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(views.find_deletion_wizard),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.find_deletion_wizard),
name="find_deletion",
),
url(r"find_delete/(?P<pk>.+)/$", views.find_delete, name="delete-find"),
url(
r"^find-qa-duplicate/(?P<pks>[0-9-]+)?/$",
- check_rights(["change_find", "change_own_find"])(
- views.QAFindDuplicateFormView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.QAFindDuplicateFormView.as_view()),
name="find-qa-duplicate",
),
url(r"get-findbasket/$", views.get_find_basket, name="get-findbasket"),
@@ -71,17 +80,26 @@ urlpatterns = [
),
url(
r"find_basket_search/(?P<step>.+)?$",
- check_rights(["view_find", "view_own_find"])(views.basket_search_wizard),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.basket_search_wizard),
name="find_basket_search",
),
url(
r"^find_basket_creation/$",
- check_rights(["view_find", "view_own_find"])(views.NewFindBasketView.as_view()),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.NewFindBasketView.as_view()),
name="new_findbasket",
),
url(
r"^find_basket_modification/(?P<step>.+)?$",
- check_rights(["view_find", "view_own_find"])(views.basket_modify_wizard),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.basket_modify_wizard),
name="find_basket_modification",
),
url(
@@ -91,139 +109,163 @@ urlpatterns = [
),
url(
r"^find_basket_modification_add/$",
- check_rights(["view_find", "view_own_find"])(
- views.SelectBasketForManagement.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.SelectBasketForManagement.as_view()),
name="select_findbasketforadd",
),
url(
r"^find_basket_modification_add/(?P<pk>[0-9]+)?/$",
- check_rights(["view_find", "view_own_find"])(
- views.SelectItemsInBasket.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.SelectItemsInBasket.as_view()),
name="select_itemsinbasket",
),
url(
r"^find_basket_modification_add_item/$",
- check_rights(["view_find", "view_own_find"])(
- views.FindBasketAddItemView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.FindBasketAddItemView.as_view()),
name="add_iteminbasket",
),
url(
r"^find_basket_modification_delete_item/(?P<basket>[0-9]+)?"
r"/(?P<find_pk>[0-9]+)?/$",
- check_rights(["view_find", "view_own_find"])(
- views.FindBasketDeleteItemView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.FindBasketDeleteItemView.as_view()),
name="delete_iteminbasket",
),
url(
r"^find_basket_list/(?P<pk>[0-9]+)?/$",
- check_rights(["view_find", "view_own_find"])(
- views.FindBasketListView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.FindBasketListView.as_view()),
name="list_iteminbasket",
),
url(
r"^find_basket_deletion/(?P<step>.+)?$",
- check_rights(["view_find", "view_own_find"])(views.basket_delete_wizard),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.basket_delete_wizard),
name="find_basket_deletion",
),
url(
r"^findbasket-qa-duplicate/(?P<pks>[0-9-]+)?/$",
- check_rights(["view_find", "view_own_find"])(
- views.QAFindbasketDuplicateFormView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.QAFindbasketDuplicateFormView.as_view()),
name="findbasket-qa-duplicate",
),
url(
r"^findbasket-add-treatment/(?P<pk>[0-9-]+)/$",
- check_rights(["change_find", "change_own_find"])(
- views.findbasket_treatment_add
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.findbasket_treatment_add),
name="findbasket-add-treatment",
),
url(
r"^findbasket-add-treatmentfile/(?P<pk>[0-9-]+)/$",
- check_rights(["add_treatmentfile", "add_own_treatmentfile"])(
- views.findbasket_treatmentfile_add
- ),
+ check_permissions(
+ ["archaeological_finds.add_treatmentfile",
+ "archaeological_finds.add_own_treatmentfile"]
+ )(views.findbasket_treatmentfile_add),
name="findbasket-add-treatmentfile",
),
url(
r"^find-add-treatment/(?P<pk>[0-9-]+)/$",
- check_rights(["change_find", "change_own_find"])(views.find_treatment_add),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.find_treatment_add),
name="find-add-treatment",
),
url(
r"^find-add-divide-treatment/(?P<pk>[0-9-]+)/$",
- check_rights(["change_find", "change_own_find"])(
- views.find_divide_treatment_add
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.find_divide_treatment_add),
name="find-add-divide-treatment",
),
url(
r"^treatmentfile-add-treatment/(?P<pk>[0-9-]+)/$",
- check_rights(["change_find", "change_own_find"])(
- views.treatmentfile_treatment_add
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatmentfile_treatment_add),
name="treatmentfile-add-treatment",
),
url(
r"^treatment-add-adminact/(?P<pk>[0-9-]+)/$",
- check_rights(["add_administrativeact"])(views.treatment_adminact_add),
+ check_permissions(
+ ["archaeological_operations.add_administrativeact"]
+ )(views.treatment_adminact_add),
name="treatment-add-adminact",
),
url(
r"^treatmentfile-add-adminact/(?P<pk>[0-9-]+)/$",
- check_rights(["add_administrativeact"])(views.treatmentfile_adminact_add),
+ check_permissions(
+ ["archaeological_operations.add_administrativeact"]
+ )(views.treatmentfile_adminact_add),
name="treatmentfile-add-adminact",
),
url(
r"^find-qa-bulk-update/(?P<pks>[0-9-]+)?/$",
- check_rights(["change_find", "change_own_find"])(views.QAFindForm.as_view()),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.QAFindForm.as_view()),
name="find-qa-bulk-update",
),
url(
r"^find-qa-bulk-update/(?P<pks>[0-9-]+)?/confirm/$",
- check_rights(["change_find", "change_own_find"])(views.QAFindForm.as_view()),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.QAFindForm.as_view()),
name="find-qa-bulk-update-confirm",
kwargs={"confirm": True},
),
url(
r"^find-qa-basket/(?P<pks>[0-9-]+)?/$",
- check_rights(["change_find", "change_own_find"])(
- views.QAFindBasketFormView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.QAFindBasketFormView.as_view()),
name="find-qa-basket",
),
url(
r"findbasket-qa-bulk-update/(?P<pks>[0-9-]+)?/$",
- check_rights([
- "change_find",
- "change_own_find",
- ])(
- views.QAFindBasketModifyView.as_view()
- ),
+ check_permissions([
+ "archaeological_finds.change_find",
+ "archaeological_finds.change_own_find",
+ ])(views.QAFindBasketModifyView.as_view()),
name="findbasket-qa-bulk-update",
),
url(
r"findbasket-qa-bulk-update/(?P<pks>[0-9-]+)?/confirm/$",
- check_rights([
- "change_find",
- "change_own_find",
- ])(
- views.QAFindBasketModifyView.as_view()
- ),
+ check_permissions([
+ "archaeological_finds.change_find",
+ "archaeological_finds.change_own_find",
+ ])(views.QAFindBasketModifyView.as_view()),
name="findbasket-qa-bulk-update-confirm",
kwargs={"confirm": True},
),
url(
r"^find-qa-packaging/(?P<pks>[0-9-]+)?/$",
- check_rights(["change_find", "change_own_find"])(
- views.QAFindTreatmentFormView.as_view()
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.QAFindTreatmentFormView.as_view()),
name="find-qa-packaging",
),
url(
@@ -234,16 +276,18 @@ urlpatterns = [
),
url(
r"^treatment_creation/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.treatment_creation_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatment_creation_wizard),
name="treatment_creation",
),
url(
r"^treatment_creation_n1/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.treatment_creation_n1_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatment_creation_n1_wizard),
name="treatment_creation_n1",
),
url(
@@ -253,16 +297,18 @@ urlpatterns = [
),
url(
r"^treatment_creation_1n/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.treatment_creation_1n_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatment_creation_1n_wizard),
name="treatment_creation_1n",
),
url(
r"^treatment_modification/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.treatment_modification_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatment_modification_wizard),
name="treatment_modification",
),
url(
@@ -272,14 +318,18 @@ urlpatterns = [
),
url(
r"^treatment_search/(?P<step>.+)?$",
- check_rights(["view_find", "view_own_find"])(views.treatment_search_wizard),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.treatment_search_wizard),
name="treatment_search",
),
url(
r"^treatment_deletion/(?P<step>.+)?$",
- check_rights(["change_treatmentfile", "change_own_treatmentfile"])(
- views.treatment_deletion_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_treatmentfile",
+ "archaeological_finds.change_own_treatmentfile"]
+ )(views.treatment_deletion_wizard),
name="treatment_deletion",
),
url(
@@ -289,21 +339,21 @@ urlpatterns = [
),
url(
r"^treatment_admacttreatment_search/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatment_administrativeact_search_wizard
),
name="treatment_admacttreatment_search",
),
url(
r"^treatment_admacttreatment/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatment_administrativeact_wizard
),
name="treatment_admacttreatment",
),
url(
r"^treatment_admacttreatment_modification/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatment_administrativeact_modification_wizard
),
name="treatment_admacttreatment_modification",
@@ -315,7 +365,7 @@ urlpatterns = [
),
url(
r"^treatment_admacttreatment_deletion/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatment_admacttreatment_deletion_wizard
),
name="treatment_admacttreatment_deletion",
@@ -332,21 +382,21 @@ urlpatterns = [
),
url(
r"^treatmentfle_admacttreatmentfle_search/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatmentfile_admacttreatmentfile_search_wizard
),
name="treatmentfle_admacttreatmentfle_search",
),
url(
r"^treatmentfle_admacttreatmentfle_modification/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatmentfile_admacttreatmentfile_modification_wizard
),
name="treatmentfle_admacttreatmentfle_modification",
),
url(
r"^treatmentfle_admacttreatmentfle/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatmentfile_admacttreatmentfile_wizard
),
name="treatmentfle_admacttreatmentfle",
@@ -358,7 +408,7 @@ urlpatterns = [
),
url(
r"^treatmentfle_admacttreatmentfle_deletion/(?P<step>.+)?$",
- check_rights(["change_administrativeact"])(
+ check_permissions(["archaeological_operations.change_administrativeact"])(
views.treatmentfile_admacttreatmentfile_deletion_wizard
),
name="treatmentfle_admacttreatmentfle_deletion",
@@ -370,23 +420,26 @@ urlpatterns = [
),
url(
r"^treatmentfle_search/(?P<step>.+)?$",
- check_rights(["view_treatmentfile", "view_own_treatmentfile"])(
- views.treatmentfile_search_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.view_treatmentfile",
+ "archaeological_finds.view_own_treatmentfile"]
+ )(views.treatmentfile_search_wizard),
name="treatmentfile_search",
),
url(
r"treatmentfle_creation/(?P<step>.+)?$",
- check_rights(["change_treatmentfile", "change_own_treatmentfile"])(
- views.treatmentfile_creation_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_treatmentfile",
+ "archaeological_finds.change_own_treatmentfile"]
+ )(views.treatmentfile_creation_wizard),
name="treatmentfile_creation",
),
url(
r"treatmentfle_modification/(?P<step>.+)?$",
- check_rights(["change_treatmentfile", "change_own_treatmentfile"])(
- views.treatmentfile_modification_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_treatmentfile",
+ "archaeological_finds.change_own_treatmentfile"]
+ )(views.treatmentfile_modification_wizard),
name="treatmentfile_modification",
),
url(
@@ -396,9 +449,10 @@ urlpatterns = [
),
url(
r"^treatmentfle_deletion/(?P<step>.+)?$",
- check_rights(["change_find", "change_own_find"])(
- views.treatmentfile_deletion_wizard
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.treatmentfile_deletion_wizard),
name="treatmentfile_deletion",
),
url(
@@ -600,14 +654,18 @@ urlpatterns = [
),
url(
r"autocomplete-findbasket/$",
- check_rights(["change_find", "change_own_find"])(views.autocomplete_findbasket),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.autocomplete_findbasket),
name="autocomplete-findbasket",
),
url(
r"autocomplete-findbasket-write/$",
- check_rights(["change_find", "change_own_find"])(
- views.autocomplete_findbasket_write
- ),
+ check_permissions(
+ ["archaeological_finds.change_find",
+ "archaeological_finds.change_own_find"]
+ )(views.autocomplete_findbasket_write),
name="autocomplete-findbasket-write",
),
url(
@@ -615,9 +673,10 @@ urlpatterns = [
),
url(
r"api/ishtar/base-finds/get-geo$",
- check_rights(["view_find", "view_own_find"])(
- views.get_geo_items,
- ),
+ check_permissions(
+ ["archaeological_finds.view_find",
+ "archaeological_finds.view_own_find"]
+ )(views.get_geo_items),
name="api-get-geo",
),
url(
@@ -639,9 +698,10 @@ urlpatterns = [
),
url(
r"autocomplete-basefind/$",
- check_rights(["view_basefind", "view_own_basefind"])(
- views.autocomplete_basefind
- ),
+ check_permissions(
+ ["archaeological_finds.view_basefind",
+ "archaeological_finds.view_own_basefind"]
+ )(views.autocomplete_basefind),
name="autocomplete-basefind",
),
]