Updated permission on typed shared content properties edit form
authorThierry Florac <tflorac@ulthar.net>
Tue, 01 Oct 2019 08:31:43 +0200
changeset 1357 329116e5f8e3
parent 1356 d40f66f6bb55
child 1358 c682811fa1ea
Updated permission on typed shared content properties edit form
src/pyams_content/shared/common/zmi/types/__init__.py
--- a/src/pyams_content/shared/common/zmi/types/__init__.py	Thu Sep 26 12:02:24 2019 +0200
+++ b/src/pyams_content/shared/common/zmi/types/__init__.py	Tue Oct 01 08:31:43 2019 +0200
@@ -10,8 +10,6 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
-__docformat__ = 'restructuredtext'
-
 import json
 
 from pyramid.decorator import reify
@@ -34,7 +32,6 @@
 from pyams_form.form import AJAXAddForm, ajax_config
 from pyams_form.interfaces.form import IWidgetForm
 from pyams_i18n.interfaces import II18n
-from pyams_i18n.widget import I18nSEOTextLineFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.container import delete_container_element
 from pyams_skin.event import get_json_table_refresh_event
@@ -45,6 +42,7 @@
 from pyams_skin.table import ActionColumn, BaseTable, NameColumn, SorterColumn, TrashColumn
 from pyams_skin.viewlet.toolbar import ToolbarAction
 from pyams_utils.adapter import ContextRequestAdapter, ContextRequestViewAdapter, adapter_config
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
 from pyams_utils.traversing import get_parent
 from pyams_utils.unicode import translate_string
 from pyams_utils.url import absolute_url
@@ -53,6 +51,9 @@
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm, AdminEditForm
 from pyams_zmi.layer import IAdminLayer
 
+
+__docformat__ = 'restructuredtext'
+
 from pyams_content import _
 
 
@@ -83,7 +84,8 @@
 
 @pagelet_config(name='add-data-type.html', context=ITypedSharedTool, layer=IPyAMSLayer,
                 permission=MANAGE_TOOL_PERMISSION)
-@ajax_config(name='add-data-type.json', context=ITypedSharedTool, layer=IPyAMSLayer, base=AJAXAddForm)
+@ajax_config(name='add-data-type.json', context=ITypedSharedTool, layer=IPyAMSLayer,
+             base=AJAXAddForm)
 class DataTypeAddForm(AdminDialogAddForm):
     """Data type add form"""
 
@@ -123,7 +125,8 @@
         event.form.widgets.errors += (Invalid(_("Specified type name is already used!")),)
 
 
-@pagelet_config(name='properties.html', context=IDataType, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
+@pagelet_config(name='properties.html', context=IDataType, layer=IPyAMSLayer,
+                permission=MANAGE_TOOL_PERMISSION)
 @ajax_config(name='properties.json', context=IDataType, layer=IPyAMSLayer)
 class DataTypeEditForm(AdminDialogEditForm):
     """Data type edit form"""
@@ -193,7 +196,8 @@
         return self.context.values()
 
 
-@adapter_config(name='sorter', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable), provides=IColumn)
+@adapter_config(name='sorter', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable),
+                provides=IColumn)
 class DatatypeSubtypesTableSorterColumn(SorterColumn):
     """Data type subtypes table sorter column"""
 
@@ -207,7 +211,8 @@
     return {'status': 'success'}
 
 
-@adapter_config(name='name', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable), provides=IColumn)
+@adapter_config(name='name', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable),
+                provides=IColumn)
 class DatatypeSubtypesTableNameColumn(NameColumn):
     """Data type subtypes table name column"""
 
@@ -216,7 +221,8 @@
     def renderHeadCell(self):
         result = super(DatatypeSubtypesTableNameColumn, self).renderHeadCell()
         registry = self.request.registry
-        viewlet = registry.queryMultiAdapter((self.context, self.request, self.table), IViewletManager,
+        viewlet = registry.queryMultiAdapter((self.context, self.request, self.table),
+                                             IViewletManager,
                                              name='pyams.widget_title')
         if viewlet is not None:
             viewlet.update()
@@ -256,7 +262,8 @@
     permission = MANAGE_TOOL_PERMISSION
 
 
-@adapter_config(name='trash', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable), provides=IColumn)
+@adapter_config(name='trash', context=(IDataType, IPyAMSLayer, DatatypeSubtypesTable),
+                provides=IColumn)
 class DatatypeSubtypesTableTrashColumn(TrashColumn):
     """Data type subtypes table trash column"""
 
@@ -344,7 +351,8 @@
         event.form.widgets.errors += (Invalid(_("Specified subtype name is already used!")),)
 
 
-@pagelet_config(name='properties.html', context=ISubType, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
+@pagelet_config(name='properties.html', context=ISubType, layer=IPyAMSLayer,
+                permission=MANAGE_TOOL_PERMISSION)
 @ajax_config(name='properties.json', context=ISubType, layer=IPyAMSLayer)
 class DataSubtypeEditForm(AdminDialogEditForm):
     """Data subtype edit form"""
@@ -397,7 +405,7 @@
 
 
 @pagelet_config(name='properties.html', context=IWfTypedSharedContent, layer=IPyAMSLayer,
-                permission=MANAGE_CONTENT_PERMISSION)
+                permission=VIEW_SYSTEM_PERMISSION)
 @ajax_config(name='properties.json', context=IWfTypedSharedContent, layer=IPyAMSLayer,
              permission=MANAGE_CONTENT_PERMISSION)
 class TypedSharedContentPropertiesEditForm(SharedContentPropertiesEditForm):