Use named permissions
authorThierry Florac <thierry.florac@onf.fr>
Thu, 08 Oct 2015 12:19:16 +0200
changeset 3 ad100f5d35c4
parent 2 2170a8f13656
child 4 4d310730cd71
Use named permissions
src/pyams_sequence/zmi/__init__.py
--- a/src/pyams_sequence/zmi/__init__.py	Thu Oct 08 12:19:00 2015 +0200
+++ b/src/pyams_sequence/zmi/__init__.py	Thu Oct 08 12:19:16 2015 +0200
@@ -16,9 +16,10 @@
 # import standard library
 
 # import interfaces
-from pyams_base.interfaces import IIndexLength
 from pyams_sequence.interfaces import ISequentialIntIds
 from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces.intids import IIndexLength
 from z3c.form.interfaces import DISPLAY_MODE, IDataExtractedEvent
 
 # import packages
@@ -33,7 +34,7 @@
 from pyams_sequence import _
 
 
-@pagelet_config(name='properties.html', context=ISequentialIntIds, layer=IPyAMSLayer, permission='system.view')
+@pagelet_config(name='properties.html', context=ISequentialIntIds, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
 class SequentialIntIdsPropertiesEditForm(AdminDialogEditForm):
     """Sequential IDs properties edit form"""
 
@@ -45,7 +46,7 @@
     fields = field.Fields(IIndexLength) + field.Fields(ISequentialIntIds)
 
     ajax_handler = 'properties.json'
-    edit_permission = 'system.manage'
+    edit_permission = MANAGE_SYSTEM_PERMISSION
 
     def updateWidgets(self, prefix=None):
         super(SequentialIntIdsPropertiesEditForm, self).updateWidgets(prefix)
@@ -62,6 +63,6 @@
 
 
 @view_config(name='properties.json', context=ISequentialIntIds, request_type=IPyAMSLayer,
-             permission='system.manage', renderer='json', xhr=True)
+             permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
 class SequentialIntIdsPropertiesAJAXEditForm(AJAXEditForm, SequentialIntIdsPropertiesEditForm):
     """Sequential IDs properties edit form, JSON renderer"""