# HG changeset patch # User Thierry Florac # Date 1535359745 -7200 # Node ID fd8e4305f85dada092998687fd7b36c49fc009d6 # Parent 264be21e5ae7757b8310da527bf7b13185078a1b Added default site root permission checker diff -r 264be21e5ae7 -r fd8e4305f85d 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)