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/r/Products.GroupUserFolder-3.55.1/Products/GroupUserFolder/GroupUserFolder.py   Products.GroupUserFolder(Download)
from AccessControl import Permissions
from AccessControl import getSecurityManager
from AccessControl import Unauthorized
from Globals import InitializeClass
from Acquisition import aq_base, aq_inner, aq_parent
        # Perform security check on destination folder
        if not getSecurityManager().checkPermission(Permissions.change_permissions, folder):
            raise Unauthorized(name = "acquireLocalRoles")
 
        return self._acquireLocalRoles(folder, status)
        # Perform security check on destination object
        if not getSecurityManager().checkPermission(Permissions.manage_properties, object):
            raise Unauthorized(name = "getLocalRolesForDisplay")
 
        return self._getLocalRolesForDisplay(object)
        # Perform security check on destination object
        if not getSecurityManager().checkPermission(Permissions.change_permissions, object):
            raise Unauthorized(name = "getAllLocalRoles")
 
        return self._getAllLocalRoles(object)
        # Perform security check on destination object
        if not getSecurityManager().checkPermission(Permissions.access_contents_information, object):
            raise Unauthorized(name = "getPloneSecurityMatrix")
 
        # Basic inits

src/p/r/Products.PlonePAS-5.0/Products/PlonePAS/pas.py   Products.PlonePAS(Download)
from Products.CMFCore.utils import getToolByName
 
from AccessControl import Unauthorized, getSecurityManager
from AccessControl.Permissions import manage_users as ManageUsers
from AccessControl.Permissions import manage_properties, change_permissions
    # Perform security check on destination object
    if not getSecurityManager().checkPermission(manage_properties, object):
        raise Unauthorized(name="getLocalRolesForDisplay")
 
    return self._getLocalRolesForDisplay(object)
def getAllLocalRoles(self, context):
    # Perform security check on destination object
    if not getSecurityManager().checkPermission(change_permissions, context):
        raise Unauthorized(name="getAllLocalRoles")
    return self._getAllLocalRoles(context)

src/p/r/Products.PlonePAS-HEAD/Products/PlonePAS/pas.py   Products.PlonePAS(Download)
from Products.CMFCore.utils import getToolByName
 
from AccessControl import Unauthorized, getSecurityManager
from AccessControl.Permissions import manage_users as ManageUsers
from AccessControl.Permissions import manage_properties, change_permissions
    # Perform security check on destination object
    if not getSecurityManager().checkPermission(manage_properties, object):
        raise Unauthorized(name="getLocalRolesForDisplay")
 
    return self._getLocalRolesForDisplay(object)
def getAllLocalRoles(self, context):
    # Perform security check on destination object
    if not getSecurityManager().checkPermission(change_permissions, context):
        raise Unauthorized(name="getAllLocalRoles")
    return self._getAllLocalRoles(context)

src/p/r/Products.CMFPlone-5.0a2/Products/CMFPlone/RegistrationTool.py   Products.CMFPlone(Download)
 
from App.class_init import InitializeClass
from AccessControl import ClassSecurityInfo, Unauthorized
from AccessControl import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
        if not membership.checkPermission('Mail forgotten password', self):
            raise Unauthorized(
                _(u"Mailing forgotten passwords has been disabled."))
 
        utils = getToolByName(self, 'plone_utils')
            if not tmp_sm.checkPermission(SetOwnPassword, portal):
                raise Unauthorized(
                    _(u"Mailing forgotten passwords has been disabled."))
        finally:
            setSecurityManager(orig_sm)

src/c/o/collective.emaillogin-1.3/collective/emaillogin/__init__.py   collective.emaillogin(Download)
    ZODBUserManager
from AccessControl import getSecurityManager
from AccessControl import Unauthorized
from AccessControl import allow_module
 
        secman = getSecurityManager()
        if not secman.checkPermission(SetOwnProperties, self):
            raise Unauthorized('you are not allowed to update this login name')
        membership = getToolByName(self, 'portal_membership')
        if not membership.isAnonymousUser():
                                 'this is unexpected)')
        else:
            raise Unauthorized('you need to log in to change your own '
                               'login name')
 
    def validateLoginName(self, loginname):
        secman = getSecurityManager()
        if not secman.checkPermission(SetOwnProperties, self):
            raise Unauthorized('you are not allowed to update this login name')
        if loginname == self.id:
    def mailPassword(self, forgotten_userid, REQUEST):
        """ Wrapper around mailPassword """
        membership = getToolByName(self, 'portal_membership')
        if not membership.checkPermission('Mail forgotten password', self):
            raise Unauthorized("Mailing forgotten passwords has been disabled")

src/p/r/Products.CMFPlone-HEAD/Products/CMFPlone/RegistrationTool.py   Products.CMFPlone(Download)
 
from App.class_init import InitializeClass
from AccessControl import ClassSecurityInfo, Unauthorized
from AccessControl import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
        if not membership.checkPermission('Mail forgotten password', self):
            raise Unauthorized(
                _(u"Mailing forgotten passwords has been disabled."))
 
        utils = getToolByName(self, 'plone_utils')
            if not tmp_sm.checkPermission(SetOwnPassword, portal):
                raise Unauthorized(
                    _(u"Mailing forgotten passwords has been disabled."))
        finally:
            setSecurityManager(orig_sm)

src/e/r/erp5-HEAD/product/ERP5Type/patches/DCWorkflow.py   erp5(Download)
from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD, TransitionDefinition
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from AccessControl import getSecurityManager, ModuleSecurityInfo, Unauthorized
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowException
        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/e/r/erp5-HEAD/product/ERP5/Document/RoleDefinition.py   erp5(Download)
 
import zope.interface
from AccessControl import ClassSecurityInfo, Unauthorized
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
    def _setRoleName(self, value):
      if value and value not in \
         zip(*self.RoleDefinition_getRoleNameItemList())[1]:
        raise Unauthorized("You are not allowed to give %s role" % value)
      self._baseSetRoleName(value)

src/p/l/plone.app.portlets-3.0.1/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-5.0a2/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)
 

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