Changed ZMI permissions
authorThierry Florac <thierry.florac@onf.fr>
Wed, 12 Jul 2017 12:36:42 +0200
changeset 85 b43215d4c9b9
parent 84 2d928c3189c0
child 86 695fa57d4b72
Changed ZMI permissions
src/pyams_security/zmi/notification.py
src/pyams_security/zmi/security.py
src/pyams_security/zmi/utility.py
--- a/src/pyams_security/zmi/notification.py	Wed Jul 12 12:35:07 2017 +0200
+++ b/src/pyams_security/zmi/notification.py	Wed Jul 12 12:36:42 2017 +0200
@@ -20,7 +20,7 @@
 from pyams_security.interfaces.notification import INotificationSettings
 from pyams_security.zmi.interfaces import ISecurityManagerMenu
 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 zope.component.interfaces import ISite
 
@@ -39,7 +39,7 @@
 
 
 @viewlet_config(name='notifications.menu', context=ISite, layer=IAdminLayer, manager=ISecurityManagerMenu,
-                permission=VIEW_SYSTEM_PERMISSION, weight=2)
+                permission=MANAGE_SYSTEM_PERMISSION, weight=2)
 class SecurityManagerNotificationsMenuItem(MenuItem):
     """Notifications properties menu item"""
 
@@ -53,7 +53,7 @@
 
 
 @pagelet_config(name='notifications.html', context=ISecurityManager, layer=IPyAMSLayer,
-                permission=VIEW_SYSTEM_PERMISSION)
+                permission=MANAGE_SYSTEM_PERMISSION)
 class SecurityManagerNotificationsEditForm(AdminDialogEditForm):
     """Security manager notifications edit form"""
 
--- a/src/pyams_security/zmi/security.py	Wed Jul 12 12:35:07 2017 +0200
+++ b/src/pyams_security/zmi/security.py	Wed Jul 12 12:36:42 2017 +0200
@@ -21,7 +21,7 @@
 from pyams_security.zmi.interfaces import IObjectSecurityMenu
 from pyams_skin.interfaces import IInnerPage, IPageHeader
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SECURITY_PERMISSION, MANAGE_ROLES_PERMISSION
+from pyams_utils.interfaces import MANAGE_SECURITY_PERMISSION, MANAGE_ROLES_PERMISSION
 from pyams_zmi.interfaces.menu import ISiteManagementMenu
 from pyams_zmi.layer import IAdminLayer
 from z3c.form.interfaces import DISPLAY_MODE, INPUT_MODE
@@ -48,7 +48,7 @@
 #
 
 @viewlet_config(name='protected-object-roles.menu', context=IDefaultProtectionPolicy, layer=IAdminLayer,
-                manager=ISiteManagementMenu, permission=VIEW_SYSTEM_PERMISSION, weight=900)
+                manager=ISiteManagementMenu, permission=MANAGE_ROLES_PERMISSION, weight=900)
 @viewletmanager_config(name='protected-object-roles.menu', layer=IAdminLayer, context=IDefaultProtectionPolicy,
                        provides=IObjectSecurityMenu)
 @implementer(IObjectSecurityMenu)
@@ -62,7 +62,7 @@
 
 
 @pagelet_config(name='protected-object-roles.html', context=IDefaultProtectionPolicy, layer=IPyAMSLayer,
-                permission=VIEW_SYSTEM_PERMISSION)
+                permission=MANAGE_ROLES_PERMISSION)
 @implementer(IWidgetForm, IInnerPage)
 class ProtectedObjectRolesEditForm(AdminEditForm):
     """Protected object roles edit form"""
--- a/src/pyams_security/zmi/utility.py	Wed Jul 12 12:35:07 2017 +0200
+++ b/src/pyams_security/zmi/utility.py	Wed Jul 12 12:36:42 2017 +0200
@@ -21,7 +21,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_SECURITY_PERMISSION
 from pyams_zmi.interfaces.menu import IControlPanelMenu
 from pyams_zmi.layer import IAdminLayer
 from z3c.table.interfaces import IValues, IColumn
@@ -68,7 +68,7 @@
 
 
 @viewlet_config(name='security-manager.menu', context=ISite, layer=IAdminLayer, manager=IControlPanelMenu,
-                permission=VIEW_SYSTEM_PERMISSION, weight=5)
+                permission=MANAGE_SECURITY_PERMISSION, weight=5)
 @viewletmanager_config(name='security-manager.menu', context=ISite, layer=IAdminLayer)
 @implementer(ISecurityManagerMenu)
 class SecurityManagerMenuItem(MenuItem):
@@ -128,7 +128,7 @@
     """Security manager plugins trash column"""
 
     icon_hint = _("Delete plug-in")
-    permission = MANAGE_SYSTEM_PERMISSION
+    permission = MANAGE_SECURITY_PERMISSION
 
     checker = lambda col, x: x.__name__ != '__system__'
 
@@ -145,7 +145,7 @@
         return ()
 
 
-@pagelet_config(name='security-manager.html', context=ISite, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='security-manager.html', context=ISite, layer=IPyAMSLayer, permission=MANAGE_SECURITY_PERMISSION)
 @implementer(IInnerPage)
 class SecurityManagerView(AdminView, ContainerView):
     """Security manager view"""
@@ -163,7 +163,7 @@
 
 
 @viewlet_config(name='security-manager.properties.menu', context=ISite, layer=IAdminLayer,
-                manager=ISecurityManagerMenu, permission=VIEW_SYSTEM_PERMISSION, weight=1)
+                manager=ISecurityManagerMenu, permission=MANAGE_SECURITY_PERMISSION, weight=1)
 class SecurityManagerPropertiesMenuItem(MenuItem):
     """Security manager properties menu"""
 
@@ -176,7 +176,8 @@
         return resource_url(manager, self.request, self.url)
 
 
-@pagelet_config(name='properties.html', context=ISecurityManager, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@pagelet_config(name='properties.html', context=ISecurityManager, layer=IPyAMSLayer,
+                permission=MANAGE_SECURITY_PERMISSION)
 class SecurityManagerEditForm(AdminDialogEditForm):
     """Security manager edit form"""
 
@@ -194,7 +195,7 @@
     fields['directory_plugins_names'].widgetFactory = OrderedPluginsFieldWidget
 
     ajax_handler = 'properties.json'
-    edit_permission = MANAGE_SYSTEM_PERMISSION
+    edit_permission = MANAGE_SECURITY_PERMISSION
 
     def getContent(self):
         return query_utility(ISecurityManager)
@@ -227,13 +228,13 @@
 
 
 @view_config(name='properties.json', context=ISecurityManager, request_type=IPyAMSLayer,
-             permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
+             permission=MANAGE_SECURITY_PERMISSION, renderer='json', xhr=True)
 class SecurityManagerAJAXEditForm(AJAXEditForm, SecurityManagerEditForm):
     """Security manager edit form, AJAX view"""
 
 
 @view_config(name='delete-plugin.json', context=ISecurityManager, request_type=IPyAMSLayer,
-             permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
+             permission=MANAGE_SECURITY_PERMISSION, renderer='json', xhr=True)
 def delete_security_manager_plugin(request):
     """Delete plug-in from security manager"""
     translate = request.localizer.translate