Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(56)  |  Call(34)  |  Derive(0)  |  Import(22)
Return whether security policy allows permission on object.

Arguments:
permission -- A permission name
object -- The object being accessed according to the permission
interaction -- This zope.security concept has no equivalent in Zope 2,
    and is ignored.

checkPermission is guaranteed to return True if permission is
CheckerPublic or None.

        def checkPermission(permission, object, interaction=None):
    """Return whether security policy allows permission on object.

    Arguments:
    permission -- A permission name
    object -- The object being accessed according to the permission
    interaction -- This zope.security concept has no equivalent in Zope 2,
        and is ignored.

    checkPermission is guaranteed to return True if permission is
    CheckerPublic or None.
    """
    if (permission in ('zope.Public', 'zope2.Public') or
        permission is None or permission is CheckerPublic):
        return True

    if isinstance(permission, basestring):
        permission = queryUtility(IPermission, unicode(permission))
        if permission is None:
            return False

    if getSecurityManager().checkPermission(permission.title, object):
        return True

    return False
        


src/s/i/silva.core.smi-3.0.3/src/silva/core/smi/content/publish/management.py   silva.core.smi(Download)
 
from DateTime import DateTime
from AccessControl.security import checkPermission
 
from silva.core.interfaces import IContainer
    def available(self):
        """ This form do not show if there is no unapproved version or if
        the current user can directly approve the content
        """
        if checkPermission('silva.ApproveSilvaContent', self.context):
    def available(self, form):
        return bool(checkPermission('silva.ApproveSilvaContent', form.context))
 
    def execute(self, form, content, data):
        # Date from the form should already be set (see PublicationAction)
    def available(self, form):
        return bool(checkPermission('silva.ApproveSilvaContent', form.context))
 
    def execute(self, form, content, data):
        # Date from the form should already be set (see PublicationAction)
    def available(self):
        return bool(checkPermission('silva.ApproveSilvaContent', self.context))
 
 
approval_status_vocabulary = SimpleVocabulary([

src/s/i/silva.core.smi-3.0.3/src/silva/core/smi/content/publish/portlet.py   silva.core.smi(Download)
 
from five import grok
from AccessControl.security import checkPermission
 
from silva.core.interfaces import IVersionedObject
        self.have_approved = self.context.is_approved()
        self.have_published = self.context.is_published()
        self.may_approve = checkPermission('silva.ApproveSilvaContent', self.context)
        self.may_change = checkPermission('silva.ChangeSilvaContent', self.context)
 

src/s/i/silva.core.smi-3.0.3/src/silva/core/smi/settings/settings.py   silva.core.smi(Download)
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Infrae. All rights reserved.
# See also LICENSE.txt
 
from AccessControl.security import checkPermission
    def available(self):
        if IRoot.providedBy(self.context):
            return False
        if not checkPermission('silva.ManageSilvaContent', self.context):
            return False
    def available(self):
        if not checkPermission('zope2.ViewManagementScreens', self.context):
            return False
        return True
 
    def available(self):
        if not checkPermission('silva.ManageSilvaContent', self.context):
            return False
        return super(FeedsForm, self).available()
 

src/s/i/silva.core.contentlayout-3.0.5/src/silva/core/contentlayout/slots/restrictions.py   silva.core.contentlayout(Download)
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 Infrae. All rights reserved.
# See also LICENSE.txt
 
from AccessControl.security import checkPermission
    def allow_configuration(self, configuration, slot, context):
        if checkPermission(self.permission, context):
            return None
        return False
 
    def allow_controller(self, controller, slot, context):
        if checkPermission(self.permission, context):

src/s/i/silva.core.smi-3.0.3/src/silva/core/smi/content/publish/status.py   silva.core.smi(Download)
from zope.traversing.browser import absoluteURL
 
from AccessControl.security import checkPermission
 
from Products.Silva.Versioning import VersioningError
    def available(self, form):
        return (len(form.lines) > 1 and
                bool(checkPermission('silva.ApproveSilvaContent', form.context)))
 
    def __call__(self, form, selected, deselected):

src/p/r/Products.SilvaExternalSources-3.0.3/Products/SilvaExternalSources/codesources/api.py   Products.SilvaExternalSources(Download)
 
from AccessControl import ModuleSecurityInfo
from AccessControl.security import checkPermission
from silva.app.document.interfaces import IDocument
from silva.core.interfaces import IAddableContents, IPublishable, ITreeContents
def render_content(content, request, suppress_title=False):
    """Render a content for inclusion.
    """
    if not (checkPermission('zope2.View', content)
            or IBrowserRequest.providedBy(request)):

src/s/i/silva.core.conf-3.0.3/src/silva/core/conf/__init__.py   silva.core.conf(Download)
def protect(permission):
    """Protect an adapter method with a permission.
    """
    from AccessControl.security import checkPermission
    from zExceptions import Unauthorized
 
    def wrapper(func):
 
        def wrapped(self, *args, **kwargs):
            if not checkPermission(permission, self.context):

src/z/e/zeam.form.silva-2.0.5/src/zeam/form/silva/form/smi.py   zeam.form.silva(Download)
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2013 Infrae. All rights reserved.
# See also LICENSE.txt
 
from AccessControl.security import checkPermission
        # called before security is verified.
        content = self.getContentData().content
        if not checkPermission('silva.ChangeSilvaContent', content):
            self.widgetFactoryFactory = SMIDisplayWidgetFactory
 
        # called before security is verified.
        content = self.getContentData().content
        if not checkPermission('silva.ChangeSilvaContent', content):
            self.widgetFactoryFactory = SMIDisplayWidgetFactory
 

src/s/i/silva.ui-3.0.3/src/silva/ui/rest/helper.py   silva.ui(Download)
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 Infrae. All rights reserved.
# See also LICENSE.txt
 
from AccessControl.security import checkPermission
            parent = root.get_real_container()
            if (parent is None or
                not checkPermission('silva.ReadSilvaContent', parent)):
                # We don't have access at that level
                break

src/s/i/silva.core.contentlayout-3.0.5/src/silva/core/contentlayout/designs/registry.py   silva.core.contentlayout(Download)
from zope.testing import cleanup
 
from AccessControl.security import checkPermission
 
from ..interfaces import IDesignLookup
            permission = grok.require.bind().get(design)
            if permission:
                return checkPermission(permission, self.context)
 
        return True

  1 | 2 | 3  Next