本文整理汇总了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):