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/e/n/enpraxis.educommons-4.1.2/enpraxis/educommons/tests/test_object_workflow.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

src/e/n/enpraxis.educommons-4.1.2/enpraxis/educommons/tests/test_object_remove.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

src/e/n/enpraxis.educommons-4.1.2/enpraxis/educommons/tests/test_object_edit.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

src/a/c/AccessControl-3.0.8/src/AccessControl/tests/testZopeGuards.py   AccessControl(Download)
    def _initPolicyAndManager(self, manager=None):
        from AccessControl.SecurityManagement import get_ident
        from AccessControl.SecurityManagement import _managers
        from AccessControl.SecurityManagement import newSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
 
        self._policy = ZopeSecurityPolicy()
        self._old_policy = setSecurityPolicy(self._policy)
 
        if manager is None:
    def _restorePolicyAndManager(self):
        from AccessControl.SecurityManagement import noSecurityManager
        from AccessControl.SecurityManager import setSecurityPolicy
 
        if self._old_mgr is not self._marker:
 
        if self._old_policy is not self._marker:
            setSecurityPolicy(self._old_policy)
 
    def _getProtectedBaseClass(self):

src/c/o/collective.timedevents-0.3/collective/timedevents/tests.py   collective.timedevents(Download)
from Products.Five import fiveconfigure
from AccessControl.ImplPython import ZopeSecurityPolicy
from AccessControl.SecurityManager import setSecurityPolicy
 
from interfaces import (ITickEvent,
    def afterSetUp(self):
        # Set verbose security policy, making debugging Unauthorized
        # exceptions great deal easier in unit tests
        setSecurityPolicy(ZopeSecurityPolicy(verbose=True))
 

src/z/o/Zope2-2.13.22/src/webdav/tests/test_davcmds.py   Zope2(Download)
import unittest
 
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
    def setUp(self):
        self._oldPolicy = setSecurityPolicy(_DummySecurityPolicy())
 
    def tearDown(self):
        noSecurityManager()
        setSecurityPolicy(self._oldPolicy)

src/z/o/Zope2-2.13.22/src/webdav/tests/testResource.py   Zope2(Download)
import unittest
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Acquisition import Implicit
    def setUp(self):
        self.app = DummyContent()
        self.app.acl_users = DummyUserFolder()
        self._policy = PermissiveSecurityPolicy()
        self._oldPolicy = setSecurityPolicy(self._policy)
        newSecurityManager(None, OmnipotentUser().__of__(self.app.acl_users))
 
    def tearDown(self):
        noSecurityManager()
        setSecurityPolicy(self._oldPolicy)

src/z/o/Zope2-2.13.22/src/Products/PageTemplates/tests/testHTMLTests.py   Zope2(Download)
        f.t = AqPageTemplate()
        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
        noSecurityManager()  # Use the new policy.
 
    def tearDown(self):
        super(HTMLTests, self).tearDown()
        SecurityManager.setSecurityPolicy( self.oldPolicy )

src/z/o/Zope2-2.13.22/src/Products/PageTemplates/tests/testDTMLTests.py   Zope2(Download)
        self.t = AqPageTemplate()
        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy(self.policy)
        noSecurityManager()  # Use the new policy.
 
    def tearDown(self):
        super(DTMLTests, self).tearDown()
        SecurityManager.setSecurityPolicy(self.oldPolicy)

src/z/o/Zope2-2.13.22/src/OFS/tests/testTraverse.py   Zope2(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):

Previous  1 | 2 | 3 | 4 | 5  Next