--- a/src/pyams_thesaurus/zmi/manager.py Wed Jun 07 10:43:15 2017 +0200
+++ b/src/pyams_thesaurus/zmi/manager.py Tue Jul 18 10:55:10 2017 +0200
@@ -19,6 +19,8 @@
from pyams_skin.interfaces import IInnerPage, IPageHeader
from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
+from pyams_thesaurus.interfaces import MANAGE_THESAURUS_CONTENT_PERMISSION, MANAGE_THESAURUS_EXTRACT_PERMISSION, \
+ ADMIN_THESAURUS_PERMISSION
from pyams_thesaurus.interfaces.thesaurus import IThesaurus
from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
from pyams_zmi.interfaces.menu import IControlPanelMenu
@@ -54,6 +56,14 @@
icon_class = 'fa-language'
url = '#thesaurus.html'
+ def __new__(cls, context, request, view, manager=None):
+ for name, thesaurus in get_utilities_for(IThesaurus):
+ if request.has_permission(ADMIN_THESAURUS_PERMISSION) or \
+ request.has_permission(MANAGE_THESAURUS_CONTENT_PERMISSION, thesaurus) or \
+ request.has_permission(MANAGE_THESAURUS_EXTRACT_PERMISSION, thesaurus):
+ return MenuItem.__new__(cls)
+ return None
+
class ControlPanelThesaurusTable(BaseTable):
"""Control panel thesaurus table"""