本文整理匯總了Python中AccessControl.SecurityInfo.ModuleSecurityInfo.declareProtected方法的典型用法代碼示例。如果您正苦於以下問題:Python ModuleSecurityInfo.declareProtected方法的具體用法?Python ModuleSecurityInfo.declareProtected怎麽用?Python ModuleSecurityInfo.declareProtected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AccessControl.SecurityInfo.ModuleSecurityInfo
的用法示例。
在下文中一共展示了ModuleSecurityInfo.declareProtected方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ModuleSecurityInfo
# 需要導入模塊: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 別名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declareProtected [as 別名]
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" GenericSetup product initialization.
"""
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.GenericSetup.interfaces import BASE
from Products.GenericSetup.interfaces import EXTENSION
from Products.GenericSetup.permissions import ManagePortal
from Products.GenericSetup.registry import _profile_registry \
as profile_registry
security = ModuleSecurityInfo('Products.GenericSetup')
security.declareProtected(ManagePortal, 'profile_registry')
def initialize(context):
import tool
context.registerClass(tool.SetupTool,
constructors=(#tool.addSetupToolForm,
tool.addSetupTool,
),
permissions=(ManagePortal,),
interfaces=None,
icon='www/tool.png',
)
# BBB: for setup tools created with CMF 1.5 if CMFSetup isn't installed
示例2: ModuleSecurityInfo
# 需要導入模塊: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 別名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declareProtected [as 別名]
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Acquisition import Implicit
from App.config import getConfiguration
from App.special_dtml import DTMLFile
from DateTime.DateTime import DateTime
from OFS.SimpleItem import Item
from OFS.PropertyManager import PropertyManager
from OFS.History import Historical
from OFS.History import html_diff
from Persistence import Persistent
modulesecurity = ModuleSecurityInfo()
modulesecurity.declareProtected('View management screens',
'manage_addZReSTForm')
manage_addZReSTForm = DTMLFile('dtml/manage_addZReSTForm', globals())
modulesecurity.declareProtected('Add RestructuredText Document', 'manage_addZReST')
def manage_addZReST(self, id, file='', REQUEST=None):
"""Add a ZReST product """
# validate the instance_home
self._setObject(id, ZReST(id))
self._getOb(id).manage_upload(file)
if REQUEST is not None:
return self.manage_main(self, REQUEST)
class Warnings:
def __init__(self):
self.messages = []
def write(self, message):