本文整理汇总了Python中AccessControl.SecurityInfo.ModuleSecurityInfo.declarePublic方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleSecurityInfo.declarePublic方法的具体用法?Python ModuleSecurityInfo.declarePublic怎么用?Python ModuleSecurityInfo.declarePublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessControl.SecurityInfo.ModuleSecurityInfo
的用法示例。
在下文中一共展示了ModuleSecurityInfo.declarePublic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
#from Products.CMFCore import permissions as CMFCorePermissions
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
security = ModuleSecurityInfo('acentoweb.submanagers')
security.declarePublic('Manage the site administratively')
setDefaultRoles('Manage the site administratively', ())
示例2: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
# -*- coding: utf-8 -*-
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
from plone.app.contenttypes.utils import DEFAULT_TYPES
security = ModuleSecurityInfo('plone.app.contenttypes')
TYPE_ROLES = ('Manager', 'Site Administrator', 'Owner', 'Contributor')
perms = []
for typename in DEFAULT_TYPES:
permid = 'Add' + typename
permname = 'plone.app.contenttypes: Add ' + typename
security.declarePublic(permid)
setDefaultRoles(permname, TYPE_ROLES)
AddCollection = "plone.app.contenttypes: Add Collection"
AddDocument = "plone.app.contenttypes: Add Document"
AddEvent = "plone.app.contenttypes: Add Event"
AddFile = "plone.app.contenttypes: Add File"
AddFolder = "plone.app.contenttypes: Add Folder"
AddImage = "plone.app.contenttypes: Add Image"
AddLink = "plone.app.contenttypes: Add Link"
AddNewsItem = "plone.app.contenttypes: Add News Item"
示例3: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
from DocumentTemplate.DT_Var import url_unquote
from DocumentTemplate.DT_Var import url_unquote_plus
from DocumentTemplate.DT_Var import restructured_text
from DocumentTemplate.security import RestrictedDTML
from ZPublisher.HTTPRequest import record
security = ModuleSecurityInfo()
security.declarePublic('special_formats',
'whole_dollars',
'dollars_and_cents',
'structured_text',
'restructured_text',
'sql_quote',
'html_quote',
'url_quote',
'url_quote_plus',
'newline_to_br',
'thousands_commas',
'url_unquote',
'url_unquote_plus',
'urlencode',
)
security.declarePublic('DTML')
class DTML(RestrictedDTML, HTML):
"""DTML objects are DocumentTemplate.HTML objects that allow
dynamic, temporary creation of restricted DTML."""
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
"""Render the DTML given a client object, REQUEST mapping,
Response, and key word arguments."""
示例4: Copyright
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" GenericSetup product exceptions.
$Id: exceptions.py 110425 2010-04-01 17:19:14Z tseaver $
"""
from AccessControl.SecurityInfo import ModuleSecurityInfo
security = ModuleSecurityInfo('Products.GenericSetup.exceptions')
security.declarePublic('BadRequest')
from zExceptions import BadRequest
示例5: registerToolInterface
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
def registerToolInterface(tool_id, tool_interface):
""" Register a tool ID for an interface
This method can go away when getToolByName is going away (CMF 2.3).
"""
global _tool_interface_registry
_tool_interface_registry[tool_id] = tool_interface
security.declarePrivate('getToolInterface')
def getToolInterface(tool_id):
""" Get the interface registered for a tool ID
"""
global _tool_interface_registry
return _tool_interface_registry.get(tool_id, None)
security.declarePublic('getToolByName')
def getToolByName(obj, name, default=_marker):
""" Get the tool, 'toolname', by acquiring it.
o Application code should use this method, rather than simply
acquiring the tool by name, to ease forward migration (e.g.,
to Zope3).
"""
tool_interface = _tool_interface_registry.get(name)
if tool_interface is not None:
try:
utility = getUtility(tool_interface)
# Site managers, except for five.localsitemanager, return unwrapped
# utilities. If the result is something which is acquisition-unaware
示例6: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
# -*- coding: utf-8 -*-
from Products.CMFCore import permissions as CMFCorePermissions
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
security = ModuleSecurityInfo('collective.deepsitemap')
security.declarePublic('Use Deep Sitemap')
MyPermission = 'collective.deepsitemap: Use Deep Sitemap'
setDefaultRoles(MyPermission, ())
示例7: list
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
if not grant_roles:
# No roles exist and no grants requested. Leave unchanged.
return 0
else:
# Add new roles for this group.
local_roles[group] = list(grant_roles)
ob.__ac_local_roles__ = local_roles
return 1
# Edit the roles.
roles = list(roles)
changed = 0
for role in managed_roles:
if role in grant_roles and role not in roles:
# Add one role for this group.
roles.append(role)
changed = 1
elif role not in grant_roles and role in roles:
# Remove one role for this group.
roles.remove(role)
changed = 1
if changed:
if not roles and local_roles.has_key(group):
del local_roles[group]
else:
local_roles[group] = roles
ob.__ac_local_roles__ = local_roles
return changed
security.declarePublic('Message')
Message = _ = MessageFactory('cmf_default')
示例8: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
# -*- coding: utf-8 -*-
from Products.CMFCore.permissions import setDefaultRoles
from AccessControl.SecurityInfo import ModuleSecurityInfo
security = ModuleSecurityInfo('rt.lastmodifier.permissions')
security.declarePublic('DocumentByLineViewAuthor')
DocumentByLineViewAuthor = 'rt.lastmodifier: documentByLine view author'
setDefaultRoles(DocumentByLineViewAuthor, ())
security.declarePublic('DocumentByLineViewLastModifier')
DocumentByLineViewLastModifier = 'rt.lastmodifier: documentByLine view last modifier'
setDefaultRoles(DocumentByLineViewLastModifier, ())
security.declarePublic('DocumentByLineViewModifiedDate')
DocumentByLineViewModifiedDate = 'rt.lastmodifier: documentByLine view modification date'
setDefaultRoles(DocumentByLineViewModifiedDate, ())
security.declarePublic('DocumentByLineViewPublishedDate')
DocumentByLineViewPublishedDate = 'rt.lastmodifier: documentByLine view publication date'
setDefaultRoles(DocumentByLineViewPublishedDate, ())
security.declarePublic('DocumentByLineViewChangeNote')
DocumentByLineViewChangeNote = 'rt.lastmodifier: documentByLine view change note'
setDefaultRoles(DocumentByLineViewChangeNote, ())
security.declarePublic('EditChangeNoteShowState')
EditChangeNoteShowState = 'rt.lastmodifier: choose to show change note'
setDefaultRoles(EditChangeNoteShowState, ())
示例9: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
security = ModuleSecurityInfo('Products.CMFCore.permissions')
security.declarePublic("DexterityImport")
DexterityImport = "collective.importexport: Import"
#TODO: should allow readers to seee this too since they can do an export?
setDefaultRoles(DexterityImport, ("Owner", "Contributor" "Site Administrator", "Manager"))
示例10: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
# -*- coding: utf-8 -*-
from AccessControl.SecurityInfo import ModuleSecurityInfo
PROJECTNAME = "domense.homeboxes"
security = ModuleSecurityInfo(PROJECTNAME)
security.declarePublic('ManageSettings')
ManageSettings = PROJECTNAME + ': Manage Homeboxes settings'
示例11: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
security = ModuleSecurityInfo('slc.docconv')
security.declarePublic('Convert')
Convert = 'slc.docconv: Convert'
setDefaultRoles(Convert, ('Manager'))
示例12: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
"""Define CMFNotification specific permissions.
$Id$
"""
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.permissions import setDefaultRoles
from config import PROJECT_NAME
security = ModuleSecurityInfo(PROJECT_NAME)
security.declarePublic('CMFNotification: Subscribe/unsubscribe')
## Warning: this value is also defined in ``profiles/default/rolemap.xml``
SUBSCRIBE_PERMISSION = 'CMFNotification: Subscribe/unsubscribe'
setDefaultRoles(SUBSCRIBE_PERMISSION, ())
示例13: rfc1123_date
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
return True
# Last-Modified will get stomped on by a cache policy if there is
# one set....
RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod))
class SimpleRecord:
""" record-like class """
def __init__(self, **kw):
self.__dict__.update(kw)
def base64_encode(text):
# Helper method to avoid deprecation warning under Python 3
if six.PY2:
return base64.encodestring(text).rstrip()
return base64.encodebytes(text).rstrip()
def base64_decode(text):
# Helper method to avoid deprecation warning under Python 3
if six.PY2:
return base64.decodestring(text)
return base64.decodebytes(text)
security.declarePublic('Message') # NOQA: flake8: D001
Message = MessageFactory('cmf_default')
示例14: ModuleSecurityInfo
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
""" CMFCore product permissions. """
from AccessControl import Permissions
from AccessControl.Permission import _registeredPermissions
from AccessControl.Permission import ApplicationDefaultPermissions
from AccessControl.Permission import pname
from AccessControl.SecurityInfo import ModuleSecurityInfo
security = ModuleSecurityInfo("Products.CMFCore.permissions")
#
# General Zope permissions
#
security.declarePublic("AccessContentsInformation")
AccessContentsInformation = Permissions.access_contents_information
security.declarePublic("ChangePermissions")
ChangePermissions = Permissions.change_permissions
security.declarePublic("DeleteObjects")
DeleteObjects = Permissions.delete_objects
security.declarePublic("FTPAccess")
FTPAccess = Permissions.ftp_access
security.declarePublic("ManageProperties")
ManageProperties = Permissions.manage_properties
security.declarePublic("ManageUsers")
示例15: __import__
# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePublic [as 别名]
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from zope.i18nmessageid import MessageFactory
messageFactory = MessageFactory('collective.portlet.oembed')
ploneMessageFactory = MessageFactory('plone')
from Products.CMFCore.permissions import setDefaultRoles
from AccessControl.SecurityInfo import ModuleSecurityInfo
security = ModuleSecurityInfo('collective.portlet.oembed')
security.declarePublic('')
AddOembedPortlet = 'collective.portlet.embed: Add oembed portlet'
setDefaultRoles(AddOembedPortlet,
('Manager', 'Site Administrator', 'Owner',))