summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/ishtar_menu.py6
-rw-r--r--archaeological_operations/urls.py38
-rw-r--r--archaeological_operations/views.py4
3 files changed, 33 insertions, 15 deletions
diff --git a/archaeological_operations/ishtar_menu.py b/archaeological_operations/ishtar_menu.py
index 2fffa5947..60f764ab7 100644
--- a/archaeological_operations/ishtar_menu.py
+++ b/archaeological_operations/ishtar_menu.py
@@ -24,6 +24,8 @@ from ishtar_common.menu_base import SectionItem, MenuItem
import models
+# be carreful: each access_controls must be relevant with check_rights in urls
+
FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
MENU_SECTIONS = [
@@ -60,8 +62,8 @@ MENU_SECTIONS = [
MenuItem('operation_source_search',
_(u"Search"),
model=models.OperationSource,
- access_controls=['change_operation',
- 'change_own_operation']),
+ access_controls=['view_operation',
+ 'view_own_operation']),
MenuItem('operation_source_creation',
_(u"Add"),
model=models.OperationSource,
diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py
index cc2c6f9ac..a6c4bd7b3 100644
--- a/archaeological_operations/urls.py
+++ b/archaeological_operations/urls.py
@@ -22,35 +22,46 @@ from django.conf.urls.defaults import *
from ishtar_common.wizards import check_rights
import views
+# be carreful: each check_rights must be relevant with ishtar_menu
+
# forms
urlpatterns = patterns(
'',
url(r'operation_administrativeactop_search/(?P<step>.+)?$',
- views.operation_administrativeactop_search_wizard,
+ check_rights(['change_administrativeact'])(
+ views.operation_administrativeactop_search_wizard),
name='operation_administrativeactop_search'),
url(r'operation_administrativeactop/(?P<step>.+)?$',
- views.operation_administrativeactop_wizard,
+ check_rights(['change_administrativeact'])(
+ views.operation_administrativeactop_wizard),
name='operation_administrativeactop'),
url(r'operation_administrativeactop_modification/(?P<step>.+)?$',
- views.operation_administrativeactop_modification_wizard,
+ check_rights(['change_administrativeact'])(
+ views.operation_administrativeactop_modification_wizard),
name='operation_administrativeactop_modification'),
url(r'operation_administrativeactop_deletion/(?P<step>.+)?$',
- views.operation_administrativeactop_deletion_wizard,
+ check_rights(['change_administrativeact'])(
+ views.operation_administrativeactop_deletion_wizard),
name='operation_administrativeactop_deletion'),
url(r'operation_source_search/(?P<step>.+)?$',
- views.operation_source_search_wizard,
+ check_rights(['view_operation', 'view_own_operation'])(
+ views.operation_source_search_wizard),
name='operation_source_search'),
url(r'operation_source_creation/(?P<step>.+)?$',
- views.operation_source_creation_wizard,
+ check_rights(['change_operation', 'change_own_operation'])(
+ views.operation_source_creation_wizard),
name='operation_source_creation'),
url(r'operation_source_modification/(?P<step>.+)?$',
- views.operation_source_modification_wizard,
+ check_rights(['change_operation', 'change_own_operation'])(
+ views.operation_source_modification_wizard),
name='operation_source_modification'),
url(r'operation_source_deletion/(?P<step>.+)?$',
- views.operation_source_deletion_wizard,
+ check_rights(['change_operation', 'change_own_operation'])(
+ views.operation_source_deletion_wizard),
name='operation_source_deletion'),
url(r'operation_search/(?P<step>.+)?$',
- views.operation_search_wizard, name='operation_search'),
+ check_rights(['view_operation', 'view_own_operation'])(
+ views.operation_search_wizard), name='operation_search'),
url(r'operation_creation/(?P<step>.+)?$',
check_rights(['add_operation'])(views.operation_creation_wizard),
name='operation_creation'),
@@ -63,11 +74,14 @@ urlpatterns = patterns(
url(r'operation_modify/(?P<pk>.+)/$',
views.operation_modify, name='operation_modify'),
url(r'operation_closing/(?P<step>.+)?$',
- views.operation_closing_wizard, name='operation_closing'),
+ check_rights(['change_operation'])(
+ views.operation_closing_wizard), name='operation_closing'),
url(r'operation_deletion/(?P<step>.+)?$',
- views.operation_deletion_wizard, name='operation_deletion'),
+ check_rights(['change_operation', 'change_own_operation'])(
+ views.operation_deletion_wizard), name='operation_deletion'),
url(r'administrativact_register/(?P<step>.+)?$',
- views.administrativact_register_wizard,
+ check_rights(['view_administrativeact', 'view_own_administrativeact'])(
+ views.administrativact_register_wizard),
name='administrativact_register'),
)
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index ae722d2bc..d3d50d791 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -26,7 +26,7 @@ from django.shortcuts import render_to_response, redirect
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from ishtar_common.views import get_item, show_item, revert_item, new_item
-from ishtar_common.wizards import SearchWizard
+from ishtar_common.wizards import SearchWizard, check_rights_condition
from ishtar_common.forms import ClosingDateFormSelection
from ishtar_common.forms_common import AuthorFormset, TownFormset, \
SourceDeletionForm
@@ -220,6 +220,8 @@ operation_creation_wizard = OperationWizard.as_view(
wizard_steps,
label=_(u"New operation"),
condition_dict={
+ 'filechoice-operation_creation':
+ check_rights_condition(['view_file']),
'preventive-operation_creation':
is_preventive('general-operation_creation', models.OperationType,
'operation_type', 'prev_excavation'),