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

All Samples(837)  |  Call(179)  |  Derive(1)  |  Import(657)

src/p/l/plone.app.portlets-HEAD/plone/app/portlets/checker.py   plone.app.portlets(Download)
from plone.app.portlets.interfaces import IPortletPermissionChecker
 
from AccessControl import getSecurityManager, Unauthorized
from Acquisition import aq_inner
 
        # run wild
        if not sm.checkPermission("Portlets: Manage portlets", context):
            raise Unauthorized("You are not allowed to manage portlets")
 
 
        # run wild
        if not sm.checkPermission("Portlets: Manage own portlets", context):
            raise Unauthorized("You are not allowed to manage portlets")
 
        user_id = sm.getUser().getId()
 
        if context.__name__ != user_id:
            raise Unauthorized("You are only allowed to manage your own portlets")
 
        if not sm.checkPermission("Portlets: Manage group portlets", context):
            raise Unauthorized("You are not allowed to manage group portlets")
 

src/p/r/Products.CMFPlone-HEAD/Products/CMFPlone/utils.py   Products.CMFPlone(Download)
 
import OFS
from AccessControl import getSecurityManager, Unauthorized
from AccessControl import ModuleSecurityInfo
from Acquisition import aq_get
    secman = getSecurityManager()
    if not secman.checkPermission(ManageUsers, member):
        raise Unauthorized('You can only change your OWN login name.')
    pas.updateLoginName(member.getId(), loginname)
 

src/s/l/slapos.core-HEAD/master/product/Vifib/Tool/SlapTool.py   slapos.core(Download)
 
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from AccessControl.Permissions import access_contents_information
from AccessControl import getSecurityManager
      document):
    return document
  raise Unauthorized('User %r has no access to %r' % (sm.getUser(), document))
 
 

src/r/e/redturtle.sendto_extension-2.0.0b2/redturtle/sendto_extension/browser/sendto.py   redturtle.sendto_extension(Download)
# -*- coding: utf-8 -*-
 
import re
from AccessControl import getSecurityManager, Unauthorized
from Products.CMFCore.utils import getToolByName
            return can_do
        if not can_do:
            raise Unauthorized("You can't query site members")
        return True
 
            return can_do
        if not can_do:
            raise Unauthorized("You can't query groups")
        return True
 
            return can_do
        if not can_do:
            raise Unauthorized("You can't send to  multiple recipients")
        return True
 

src/c/o/collective.deletepermission-1.1.3/collective/deletepermission/del_object.py   collective.deletepermission(Download)
from AccessControl import Unauthorized
from AccessControl import getSecurityManager
from Products.CMFCore.PortalFolder import PortalFolderBase as PortalFolder
 
 
    if not sm.checkPermission('Delete objects', self):
        raise Unauthorized(
            "Do not have permissions to remove this object")
 
    if ids is None:
        if not sm.checkPermission("Delete portal content", item):
            raise Unauthorized(
                "Do not have permissions to remove this object")
    return PortalFolder.manage_delObjects(self, ids, REQUEST=REQUEST)
 

src/e/r/erp5-HEAD/product/ERP5/Document/BusinessTemplate.py   erp5(Download)
from Products.ERP5Type.Globals import Persistent, PersistentMapping
from Acquisition import Implicit, aq_base, aq_inner, aq_parent
from AccessControl import ClassSecurityInfo, Unauthorized, getSecurityManager
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.CMFCore.utils import getToolByName
          try:
            if not validate(container, container, key, value):
              raise Unauthorized('unauthorized access to element %s' % key)
          except Unauthorized:
            LOG('BusinessTemplate', WARNING,

src/p/r/Products.PlonePAS-5.0/Products/PlonePAS/tools/groupdata.py   Products.PlonePAS(Download)
from Acquisition import aq_parent
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from AccessControl import Permissions
from AccessControl import getSecurityManager
    def addMember(self, id, REQUEST=None):
        """ Add the existing member with the given id to the group"""
        if not self.canAdministrateGroup():
            raise Unauthorized("You cannot add a member to the group.")
 
    def removeMember(self, id, REQUEST=None):
        """Remove the member with the provided id from the group.
        """
        if not self.canAdministrateGroup():
            raise Unauthorized("You cannot remove a member from the group.")

src/e/r/erp5-HEAD/product/ERP5Type/patches/WorkflowTool.py   erp5(Download)
# Make sure Interaction Workflows are called even if method not wrapped
 
from AccessControl import Unauthorized
from Products.CMFCore.WorkflowTool import WorkflowTool
from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted
        raise WorkflowException, 'Object is in an undefined state'
    if method_id not in sdef.transitions:
        raise Unauthorized(method_id)
    tdef = self.transitions.get(method_id, None)
    if tdef is None or tdef.trigger_type != TRIGGER_WORKFLOW_METHOD:
        raise WorkflowException, (
            'Transition %s is not triggered by a workflow method'
            % method_id)
    if not self._checkTransitionGuard(tdef, ob):
        raise Unauthorized(method_id)

src/c/o/collective.mrwiggin-0.1a2/collective/mrwiggin/traversable.py   collective.mrwiggin(Download)
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from AccessControl import Unauthorized
from AccessControl.ZopeGuards import guarded_getattr
from Acquisition import Acquired, aq_inner, aq_parent, aq_base
                if next is not None:
                    if restricted and not validate(obj, obj, name, next):
                        raise Unauthorized(name)
                    obj = next
                    continue
                        if restricted and not validate(
                            obj, obj, name, next):
                            raise Unauthorized(name)
                    except TraversalError:
                        raise AttributeError(name)
                                guarded_getattr(obj, name, _marker)
                                    is not next):
                                raise Unauthorized(name)
                else:
                    if getattr(aq_base(obj), name, _marker) is not _marker:
                        if restricted and not validate(
                            obj, obj, None, next):
                            raise Unauthorized(name)
 
            except (AttributeError, NotFound, KeyError), e:

src/p/r/Products.PlonePAS-HEAD/Products/PlonePAS/tools/groupdata.py   Products.PlonePAS(Download)
from Acquisition import aq_parent
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from AccessControl import Permissions
from AccessControl import getSecurityManager
    def addMember(self, id, REQUEST=None):
        """ Add the existing member with the given id to the group"""
        if not self.canAdministrateGroup():
            raise Unauthorized("You cannot add a member to the group.")
 
    def removeMember(self, id, REQUEST=None):
        """Remove the member with the provided id from the group.
        """
        if not self.canAdministrateGroup():
            raise Unauthorized("You cannot remove a member from the group.")

Previous  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next