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

All Samples(131)  |  Call(84)  |  Derive(0)  |  Import(47)
Set the system default security policy.

This method should only be caused by system startup code. It should
never, for example, be called during a web request.

        def setSecurityPolicy(aSecurityPolicy):
    """Set the system default security policy.

    This method should only be caused by system startup code. It should
    never, for example, be called during a web request.
    """
    last = _ImplPython._defaultPolicy
    _ImplPython._defaultPolicy = aSecurityPolicy
    return last
        


src/z/o/Zope-HEAD/src/OFS/tests/testTraverse.py   Zope(Download)
 
        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
        newSecurityManager( None, self._makeUser().__of__( self.root ) )
 
            policy = self.oldPolicy
        noSecurityManager()
        SecurityManager.setSecurityPolicy(policy)
 
    def test_interfaces(self):

src/z/o/Zope-HEAD/src/OFS/tests/testObjectManager.py   Zope(Download)
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from AccessControl.SpecialUsers import emergency_user, nobody, system
from AccessControl.User import User # before SpecialUsers
                             {'name': 'Baz'})
        try:
            oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
            self.assertEqual(len(om.filtered_meta_types()), 2)
            self.assertEqual(om.filtered_meta_types()[0]['name'], 'Foo')
            self.assertEqual(om.filtered_meta_types()[1]['name'], 'Baz')
        finally:
            noSecurityManager()
            setSecurityPolicy(oldPolicy)

src/z/o/Zope-HEAD/src/OFS/tests/testCopySupport.py   Zope(Download)
 
        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
 
    def tearDown( self ):
 
        noSecurityManager()
        SecurityManager.setSecurityPolicy( self.oldPolicy )
 
        if self._old_policy is not None:
            SecurityManager.setSecurityPolicy( self._old_policy )
 
    def _assertCopyErrorUnauth( self, callable, *args, **kw ):
 
        scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
        self._old_policy = SecurityManager.setSecurityPolicy( scp )
 
        newSecurityManager( None

src/c/o/collective.simplemanagement-HEAD/booking2delete_ONLY_FOR_TEST.py   collective.simplemanagement(Download)
import sys
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
from Products.CMFCore.tests.base.security import (PermissiveSecurityPolicy,
    """
    _policy = PermissiveSecurityPolicy()
    _oldpolicy = setSecurityPolicy(_policy)
    newSecurityManager(None, OmnipotentUser().__of__(app.acl_users))
    return makerequest(app)

src/p/r/Products.SimpleUserFolder-2.0.0/Products/SimpleUserFolder/tests/base.py   Products.SimpleUserFolder(Download)
from AccessControl import AuthEncoding
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from AccessControl.User import UnrestrictedUser
from OFS.Folder import manage_addFolder
            begin()
        self._policy = PermissiveSecurityPolicy()
        self._oldPolicy = setSecurityPolicy(self._policy)
        self.connection = Zope.DB.open()
        self.root =  self.connection.root()[ 'Application' ]
        self.connection.close()
        noSecurityManager()
        setSecurityPolicy(self._oldPolicy)
 
    def _createFolder(self,creatUserFolder=0):

src/p/r/Products.PluggableAuthService-1.10.0/Products/PluggableAuthService/tests/test_PluggableAuthService.py   Products.PluggableAuthService(Download)
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from OFS.ObjectManager import ObjectManager
from zExceptions import Unauthorized
 
        if self._oldSecurityPolicy is not None:
            setSecurityPolicy( self._oldSecurityPolicy )
 
        noSecurityManager()
                return 1
 
        self._oldSecurityPolicy = setSecurityPolicy( PermissiveSP() )
 
        self.failUnless( zcuf._authorizeUser( faux
                return 0
 
        self._oldSecurityPolicy = setSecurityPolicy( ParanoidSP() )
 
        self.failIf( zcuf._authorizeUser( faux

src/p/r/Products.FileSystemSite-2.4/Products/FileSystemSite/tests/base/testcase.py   Products.FileSystemSite(Download)
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
import zLOG
    def setUp(self):
        transaction.begin()
        self._policy = PermissiveSecurityPolicy()
        self._oldPolicy = setSecurityPolicy(self._policy)
        self.connection = Zope2.DB.open()
    def tearDown( self ):
        transaction.abort()
        self.connection.close()
        noSecurityManager()
        setSecurityPolicy(self._oldPolicy)

src/p/r/Products.Reflecto-3.0.5/Products/Reflecto/tests/testDirectory.py   Products.Reflecto(Download)
 
        self.oldpolicy = SecurityManager.setSecurityPolicy(
            UnitTestSecurityPolicy())
        newSecurityManager(None, UnitTestUser().__of__(self.root))
 
    def tearDown(self):
        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldpolicy)

src/c/o/collective.diversion-1.0/src/collective/diversion/tests/test_zope_integration.py   collective.diversion(Download)
from OFS.SimpleItem import SimpleItem
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
 
import collective.diversion
 
        _policy=PermissiveSecurityPolicy()
        setSecurityPolicy(_policy)
        newSecurityManager(None, OmnipotentUser().__of__(root.acl_users))
 

src/e/n/enpraxis.educommons-4.1.2/enpraxis/educommons/tests/test_view_permissions.py   enpraxis.educommons(Download)
from unittest import TestSuite, makeSuite
from zope.annotation.interfaces import IAnnotations
from AccessControl.SecurityManager import setSecurityPolicy
from Products.CMFCore.utils import _checkPermission as checkPerm
from AccessControl import ZopeGuards
        self.membership = self.portal.portal_membership
 
        setSecurityPolicy(ZopeSecurityPolicy(verbose=True))
 
        # We need to manually register the roles from the rolemap with

Previous  1 | 2 | 3 | 4 | 5  Next