Back to index

plone3  3.1.7
info.py
Go to the documentation of this file.
00001 from zope.component import queryUtility
00002 from plone.contentrules.engine.interfaces import IRuleStorage
00003 from plone.contentrules.engine.interfaces import IRuleAssignable
00004 
00005 from AccessControl import getSecurityManager
00006 from Products.Five.browser import BrowserView
00007 
00008 class ContentRulesInfo(BrowserView):
00009     
00010     def show_rules_tab(self):
00011         """Whether or not the rules tab should be shown
00012         """
00013         
00014         if not IRuleAssignable.providedBy(self.context):
00015             return False
00016             
00017         if not getSecurityManager().checkPermission('Content rules: Manage rules', self.context):
00018             return False
00019             
00020         storage = queryUtility(IRuleStorage)
00021         if storage is None:
00022             return False
00023             
00024         return storage.active