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/Zope2-2.13.22/src/OFS/tests/testObjectManager.py   Zope2(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/Zope2-2.13.22/src/OFS/tests/testCopySupport.py   Zope2(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/p/r/Products.CMFUid-2.3.0-beta/Products/CMFUid/tests/test_uidannotation.py   Products.CMFUid(Download)
 
        scp = _SensitiveSecurityPolicy(v_lambda, c_lambda)
        SecurityManager.setSecurityPolicy(scp)
        newSecurityManager(None
                          , _AllowedUser(a_lambda).__of__(self.app.acl_users))

src/p/r/Products.CompositePage-1.1/Products/CompositePage/tests/test_tool.py   Products.CompositePage(Download)
    def setUp(self):
        from AccessControl.SecurityManagement import noSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
        from OFS.Folder import Folder
        from Products.CompositePage.slot import Slot
        self.slot._setObject(g.id, g)
        self.root.otherslot = Slot("otherslot")
        self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy())
        noSecurityManager()
 
    def tearDown(self):
        from AccessControl.SecurityManagement import noSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
        setSecurityPolicy(self.old_policy)

src/p/r/Products.CompositePage-1.1/Products/CompositePage/tests/test_composite.py   Products.CompositePage(Download)
    def setUp(self):
        from zope.testing.cleanup import cleanUp
        from AccessControl.SecurityManagement import noSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
        from Products.CompositePage.tests.test_tool \
            import PermissiveSecurityPolicy
        cleanUp()
        self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy())
    def tearDown(self):
        from zope.testing.cleanup import cleanUp
        from AccessControl.SecurityManagement import noSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
        setSecurityPolicy(self.old_policy)

src/p/r/Products.CMFCore-2.2.8/Products/CMFCore/tests/test_utils.py   Products.CMFCore(Download)
        from AccessControl.Permission import Permission
        from AccessControl.SecurityManagement import newSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
        from Products.CMFCore.utils import _checkPermission
 
        setSecurityPolicy(ZopeSecurityPolicy())

src/p/r/Products.CMFCore-2.2.8/Products/CMFCore/tests/test_PortalFolder.py   Products.CMFCore(Download)
 
        scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
        SecurityManager.setSecurityPolicy( scp )
 
        newSecurityManager( None

src/p/r/Products.CMFCore-2.2.8/Products/CMFCore/tests/test_CMFCatalogAware.py   Products.CMFCore(Download)
 
        scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
        SecurityManager.setSecurityPolicy( scp )
        newSecurityManager( None
                          , _AllowedUser(a_lambda).__of__(self.app.acl_users))

src/p/r/Products.CMFCore-2.2.8/Products/CMFCore/tests/base/testcase.py   Products.CMFCore(Download)
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
 
from dummy import DummyFolder
    def setUp(self):
        TransactionalTest.setUp(self)
        self._policy = PermissiveSecurityPolicy()
        self._oldPolicy = setSecurityPolicy(self._policy)
        newSecurityManager(None, AnonymousUser().__of__(self.app.acl_users))
 
    def tearDown(self):
        noSecurityManager()
        setSecurityPolicy(self._oldPolicy)

src/p/r/Products.StandardCacheManagers-2.13.0/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py   Products.StandardCacheManagers(Download)
 
        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy(self.policy)
 
        cm_id = 'cache'
    def tearDown(self):
 
        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldPolicy)
        del self.oldPolicy

Previous  1 | 2 | 3 | 4 | 5