Added default site root permission checker
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 10:49:05 +0200
changeset 87 fd8e4305f85d
parent 86 264be21e5ae7
child 88 1c7011389ca0
Added default site root permission checker
src/pyams_zmi/zmi/site.py
--- a/src/pyams_zmi/zmi/site.py	Mon Aug 27 10:47:22 2018 +0200
+++ b/src/pyams_zmi/zmi/site.py	Mon Aug 27 10:49:05 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_form.interfaces.form import IWidgetForm
+from pyams_form.interfaces.form import IWidgetForm, IFormContextPermissionChecker
 from pyams_skin.interfaces import IInnerPage, IPageHeader, IContentTitle
 from pyams_skin.interfaces.configuration import IConfiguration, IBackOfficeConfiguration
 from pyams_skin.layer import IPyAMSLayer
@@ -31,7 +31,7 @@
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.page import DefaultPageHeaderAdapter
 from pyams_skin.viewlet.menu import MenuItem
-from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextAdapter
 from pyams_viewlet.manager import viewletmanager_config
 from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminEditForm, AdminDialogEditForm
@@ -56,6 +56,13 @@
 # Configuration properties
 #
 
+@adapter_config(context=ISiteRoot, provides=IFormContextPermissionChecker)
+class SiteRootPermissionChecker(ContextAdapter):
+    """Site root permission checker"""
+
+    edit_permission = MANAGE_SYSTEM_PERMISSION
+
+
 @viewlet_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer, manager=ISiteManagementMenu,
                 permission=VIEW_SYSTEM_PERMISSION, weight=40)
 @viewletmanager_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer, provides=IPropertiesMenu)