# HG changeset patch # User Thierry Florac # Date 1528212902 -7200 # Node ID e735477895715d84f772538ded99b0a8ca5438bb # Parent e8befd0dd9328b661586a6a29f33364f16a8fdb4 Set selected workflow to display mode except for system administrator diff -r e8befd0dd932 -r e73547789571 src/pyams_content/shared/common/zmi/manager.py --- a/src/pyams_content/shared/common/zmi/manager.py Tue Jun 05 17:05:17 2018 +0200 +++ b/src/pyams_content/shared/common/zmi/manager.py Tue Jun 05 17:35:02 2018 +0200 @@ -23,9 +23,11 @@ from pyams_skin.interfaces import IInnerPage, IPageHeader, IContentTitle from pyams_skin.interfaces.viewlet import IMenuHeader, IBreadcrumbItem from pyams_skin.layer import IPyAMSLayer +from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION from pyams_zmi.interfaces import IPropertiesEditForm from pyams_zmi.interfaces.menu import IPropertiesMenu, ISiteManagementMenu from pyams_zmi.layer import IAdminLayer +from z3c.form.interfaces import DISPLAY_MODE # import packages from pyams_form.form import AJAXEditForm @@ -109,6 +111,11 @@ ajax_handler = 'properties.json' edit_permission = MANAGE_TOOL_PERMISSION + def updateWidgets(self, prefix=None): + super(SharedToolPropertiesEditForm, self).updateWidgets(prefix) + if not self.request.has_permission(MANAGE_SYSTEM_PERMISSION, context=self.context): + self.widgets['shared_content_workflow'].mode = DISPLAY_MODE + @view_config(name='properties.json', context=IBaseSharedTool, request_type=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION, renderer='json', xhr=True)