Updated ZMI permissions
authorThierry Florac <thierry.florac@onf.fr>
Tue, 18 Jul 2017 10:54:11 +0200
changeset 36 42761bc38f66
parent 35 d7024f05f72d
child 37 1eb0c2098d47
Updated ZMI permissions
src/pyams_scheduler/zmi/scheduler.py
src/pyams_scheduler/zmi/ssh.py
src/pyams_scheduler/zmi/task.py
src/pyams_scheduler/zmi/url.py
src/pyams_scheduler/zmi/zodb.py
--- a/src/pyams_scheduler/zmi/scheduler.py	Thu Jun 08 10:51:20 2017 +0200
+++ b/src/pyams_scheduler/zmi/scheduler.py	Tue Jul 18 10:54:11 2017 +0200
@@ -26,7 +26,7 @@
 from pyams_skin.interfaces import IInnerPage, IPageHeader
 from pyams_skin.interfaces.container import ITableElementEditor
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
 from pyams_zmi.interfaces.menu import IControlPanelMenu
 from pyams_zmi.layer import IAdminLayer
 from z3c.table.interfaces import IColumn, IValues
@@ -73,7 +73,7 @@
 
 
 @viewlet_config(name='scheduler.menu', context=ISite, layer=IAdminLayer, manager=IControlPanelMenu,
-                permission=VIEW_SYSTEM_PERMISSION, weight=10)
+                permission=MANAGE_SYSTEM_PERMISSION, weight=10)
 @viewletmanager_config(name='scheduler.menu', context=ISite, layer=IAdminLayer)
 @implementer(ISchedulerMenu)
 class SchedulerMenuItem(MenuItem):
@@ -121,7 +121,7 @@
     target = None
     modal_target = True
 
-    permission = VIEW_SYSTEM_PERMISSION
+    permission = MANAGE_SYSTEM_PERMISSION
     weight = 1
 
 
@@ -135,7 +135,7 @@
     target = None
     modal_target = True
 
-    permission = VIEW_SYSTEM_PERMISSION
+    permission = MANAGE_SYSTEM_PERMISSION
     weight = 2
 
 
@@ -172,7 +172,7 @@
     target = None
     modal_target = True
 
-    permission = VIEW_SYSTEM_PERMISSION
+    permission = MANAGE_SYSTEM_PERMISSION
     weight = 30
 
 
@@ -214,7 +214,7 @@
         return ()
 
 
-@pagelet_config(name='scheduler-tasks.html', context=ISite, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='scheduler-tasks.html', context=ISite, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 @implementer(IInnerPage)
 class SchedulerTasksView(AdminView, ContainerView):
     """Scheduler tasks view"""
@@ -235,7 +235,7 @@
 
 
 @viewlet_config(name='scheduler.properties.menu', context=ISite, layer=IAdminLayer,
-                manager=ISchedulerMenu, permission=VIEW_SYSTEM_PERMISSION, weight=1)
+                manager=ISchedulerMenu, permission=MANAGE_SYSTEM_PERMISSION, weight=1)
 class SchedulerPropertiesMenuItem(MenuItem):
     """Scheduler properties menu"""
 
@@ -248,7 +248,7 @@
         return resource_url(manager, self.request, self.url)
 
 
-@pagelet_config(name='properties.html', context=IScheduler, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='properties.html', context=IScheduler, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class SchedulerPropertiesEditForm(AdminDialogEditForm):
     """Scheduler properties edit form"""
 
@@ -270,7 +270,7 @@
 
 
 @viewlet_config(name='scheduler.jobs.menu', context=ISite, layer=IAdminLayer,
-                manager=ISchedulerMenu, permission=VIEW_SYSTEM_PERMISSION, weight=5)
+                manager=ISchedulerMenu, permission=MANAGE_SYSTEM_PERMISSION, weight=5)
 class SchedulerJobsMenuItem(MenuItem):
     """Scheduler jobs menu"""
 
@@ -283,7 +283,7 @@
         return resource_url(manager, self.request, self.url)
 
 
-@pagelet_config(name='jobs.html', context=IScheduler, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='jobs.html', context=IScheduler, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class SchedulerJobsDisplayForm(AdminDialogDisplayForm):
     """Scheduler jobs display form"""
 
--- a/src/pyams_scheduler/zmi/ssh.py	Thu Jun 08 10:51:20 2017 +0200
+++ b/src/pyams_scheduler/zmi/ssh.py	Tue Jul 18 10:54:11 2017 +0200
@@ -19,7 +19,7 @@
 from pyams_scheduler.interfaces.ssh import ISSHCallerTask, ISSHCallerTaskInfo
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
 from zope.component.interfaces import ISite
 
 # import packages
@@ -67,7 +67,7 @@
     """SSH command task add form, AJAX view"""
 
 
-@pagelet_config(name='settings.html', context=ISSHCallerTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='settings.html', context=ISSHCallerTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class SSHTaskEditForm(AdminDialogEditForm):
     """SSH command task edit form"""
 
--- a/src/pyams_scheduler/zmi/task.py	Thu Jun 08 10:51:20 2017 +0200
+++ b/src/pyams_scheduler/zmi/task.py	Tue Jul 18 10:54:11 2017 +0200
@@ -20,7 +20,7 @@
 from pyams_scheduler.interfaces import ITaskInfo, IScheduler, ITask, ICronTask, ICronTaskScheduling, IDateTask, \
     IDateTaskScheduling, ILoopTask, ILoopTaskScheduling, ITaskHistory, IBaseTaskScheduling
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
 from pyams_zmi.layer import IAdminLayer
 from z3c.form.interfaces import IDataExtractedEvent, DISPLAY_MODE
 from z3c.table.interfaces import IValues, IColumn
@@ -94,7 +94,7 @@
         event.form.widgets.errors += (Invalid(_("Specified task name is already used!")),)
 
 
-@pagelet_config(name='properties.html', context=ITask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='properties.html', context=ITask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class TaskPropertiesEditForm(AdminDialogEditForm):
     """Scheduler task properties edit form"""
 
@@ -156,7 +156,7 @@
             return super(TaskSchedulerAJAXEditForm, self).get_ajax_output(changes)
 
 
-@pagelet_config(name='schedule.html', context=ICronTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='schedule.html', context=ICronTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class CronTaskScheduleEditForm(TaskScheduleEditForm):
     """Cron-style task schedule edit form"""
 
@@ -169,7 +169,7 @@
     """Cron-style task schedule edit form, AJAX view"""
 
 
-@pagelet_config(name='schedule.html', context=IDateTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='schedule.html', context=IDateTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class DateTaskScheduleEditForm(TaskScheduleEditForm):
     """Date-style task schedule edit form"""
 
@@ -182,7 +182,7 @@
     """Date-style task schedule edit form, AJAX view"""
 
 
-@pagelet_config(name='schedule.html', context=ILoopTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='schedule.html', context=ILoopTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class LoopTaskScheduleEditForm(TaskScheduleEditForm):
     """Loop-style task schedule edit form"""
 
@@ -279,7 +279,7 @@
     """Task debug report viewlet"""
 
 
-@pagelet_config(name='history.html', context=ITask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='history.html', context=ITask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class TaskHistoryDisplayForm(AdminDialogDisplayForm):
     """Task history display form"""
 
@@ -363,7 +363,7 @@
 
 
 @view_config(name='info.json', context=ITaskHistory, request_type=IPyAMSLayer,
-             permission=VIEW_SYSTEM_PERMISSION, renderer='json', xhr=True)
+             permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
 def TaskHistoryInfoView(request):
     return {'status': 'success',
             'close_form': False,
--- a/src/pyams_scheduler/zmi/url.py	Thu Jun 08 10:51:20 2017 +0200
+++ b/src/pyams_scheduler/zmi/url.py	Tue Jul 18 10:54:11 2017 +0200
@@ -19,7 +19,7 @@
 from pyams_scheduler.interfaces.url import IURLCallerTask, IURLCallerTaskInfo
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
 from zope.component.interfaces import ISite
 
 # import packages
@@ -67,7 +67,7 @@
     """URL caller task add form, AJAX view"""
 
 
-@pagelet_config(name='settings.html', context=IURLCallerTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='settings.html', context=IURLCallerTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class URLTaskEditForm(AdminDialogEditForm):
     """URL caller task edit form"""
 
--- a/src/pyams_scheduler/zmi/zodb.py	Thu Jun 08 10:51:20 2017 +0200
+++ b/src/pyams_scheduler/zmi/zodb.py	Tue Jul 18 10:54:11 2017 +0200
@@ -19,7 +19,7 @@
 from pyams_scheduler.interfaces.zodb import IZODBPackingTask, IZODBPackingTaskInfo
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
 from zope.component.interfaces import ISite
 
 # import packages
@@ -67,7 +67,7 @@
     """ZODB packing task add form, AJAX view"""
 
 
-@pagelet_config(name='settings.html', context=IZODBPackingTask, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='settings.html', context=IZODBPackingTask, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
 class ZODBTaskEditForm(AdminDialogEditForm):
     """ZODB packing task edit form"""