當前位置: 首頁>>代碼示例>>Python>>正文


Python ModuleSecurityInfo.declarePublic方法代碼示例

本文整理匯總了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', ())
開發者ID:dukebody,項目名稱:acentoweb.submanagers,代碼行數:13,代碼來源:__init__.py

示例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"
開發者ID:Blaastolen,項目名稱:plone.app.contenttypes,代碼行數:27,代碼來源:permissions.py

示例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."""
開發者ID:c0ns0le,項目名稱:zenoss-4,代碼行數:33,代碼來源:standard.py

示例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
開發者ID:c0ns0le,項目名稱:zenoss-4,代碼行數:24,代碼來源:exceptions.py

示例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
開發者ID:goschtl,項目名稱:zope,代碼行數:33,代碼來源:utils.py

示例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, ())

開發者ID:PloneGov-IT,項目名稱:collective.deepsitemap,代碼行數:13,代碼來源:permissions.py

示例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')
開發者ID:goschtl,項目名稱:zope,代碼行數:32,代碼來源:utils.py

示例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, ())
開發者ID:RedTurtle,項目名稱:rt.lastmodifier,代碼行數:32,代碼來源:permissions.py

示例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"))
開發者ID:collective,項目名稱:collective.importexport,代碼行數:11,代碼來源:permissions.py

示例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'
開發者ID:domsense,項目名稱:domsense.homeboxes,代碼行數:10,代碼來源:permissions.py

示例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'))
開發者ID:syslabcom,項目名稱:slc.docconv,代碼行數:9,代碼來源:permissions.py

示例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, ())
開發者ID:collective,項目名稱:Products.CMFNotification,代碼行數:16,代碼來源:permissions.py

示例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')
開發者ID:zopefoundation,項目名稱:Products.CMFCore,代碼行數:32,代碼來源:utils.py

示例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")
開發者ID:pigaov10,項目名稱:plone4.3,代碼行數:33,代碼來源:permissions.py

示例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',))
開發者ID:collective,項目名稱:collective.portlet.oembed,代碼行數:22,代碼來源:__init__.py


注:本文中的AccessControl.SecurityInfo.ModuleSecurityInfo.declarePublic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。