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

All Samples(271)  |  Call(158)  |  Derive(0)  |  Import(113)
install *manager* as current security manager for this thread.

        def setSecurityManager(manager):
    """install *manager* as current security manager for this thread."""
    thread_id=get_ident()
    _managers[thread_id]=manager
        


src/e/r/erp5-HEAD/product/ERP5Security/ERP5GroupManager.py   erp5(Download)
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import newSecurityManager,\
    getSecurityManager, setSecurityManager
from Products.PageTemplates.PageTemplateFile import PageTemplateFile

src/e/r/erp5-HEAD/product/ERP5/Document/Document.py   erp5(Download)
from zLOG import LOG
from AccessControl import ClassSecurityInfo, getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager, setSecurityManager
from Acquisition import aq_base
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter

src/c/o/collective.cron-2.7/src/collective/cron/upgrades/__init__.py   collective.cron(Download)
    from plone.app.upgrade import utils as migration_util
 
from AccessControl.SecurityManagement import getSecurityManager, setSecurityManager
from Products.CMFCore.utils import getToolByName
from Products.ATContentTypes.interface.image import IATImage

src/g/o/gocept.linkchecker-3.0a9/src/gocept/linkchecker/scripts/crawl-site.py   gocept.linkchecker(Download)
import datetime
import ZODB.POSException
from AccessControl.SecurityManagement import \
    newSecurityManager, setSecurityManager
from Testing.makerequest import makerequest

src/e/r/erp5-HEAD/product/ERP5/tests/testAlarm.py   erp5(Download)
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyMailHost
from AccessControl.SecurityManagement import newSecurityManager, \
        getSecurityManager, setSecurityManager
from AccessControl import Unauthorized
 
    # Non-managers must not be able to invoke the automatic fixation.
    setSecurityManager(sm)
    alarm.setEnabled(True)
    self.assertEqual(alarm.getEnabled(), True)
    newSecurityManager(None, user)
    self.assertRaises(Unauthorized, alarm.activeSense, fixit=1)
 
    # Now, check that everybody can invoke an enabled alarm manually.
    setSecurityManager(sm)
    self.tic()
    self.assertEqual(alarm.getProperty('bogus', None), correct_answer)
    setSecurityManager(sm)
    alarm.setProperty('bogus', None)
 

src/e/u/Euphorie-6.3.1/src/euphorie/client/tests/test_session.py   Euphorie(Download)
    def test_session_valid_session_open(self):
        import mock
        from .. import model
        from AccessControl.SecurityManagement import getSecurityManager
        from AccessControl.SecurityManagement import setSecurityManager
                self.assertTrue(mgr.session is session)
            finally:
                setSecurityManager(sm)
 
    def test_resume_enforce_same_account(self):
        from AccessControl.SecurityManagement import getSecurityManager
        from AccessControl.SecurityManagement import setSecurityManager
            self.assertRaises(ValueError, mgr.resume, session)
        finally:
            setSecurityManager(sm)
 

src/e/r/erp5-HEAD/product/ERP5Type/tests/SecurityTestCase.py   erp5(Download)
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from AccessControl import SpecialUsers
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
           ', '.join(groups)))
    finally:
      setSecurityManager(sm)
 
 
            document, ', '.join(user.getRolesInContext(document))))
    finally:
      setSecurityManager(sm)
 
 
                  ", ".join(user.getRolesInContext(document))))
    finally:
      setSecurityManager(sm)
 
  def failUnlessUserCanPassWorkflowTransition(self, username,
                  "\n\t".join(workflow_transitions_description)))
    finally:
      setSecurityManager(sm)
 
  assertUserCanPassWorkflowTransition = failUnlessUserCanPassWorkflowTransition

src/e/u/Euphorie-6.3.1/src/euphorie/client/tests/test_profile.py   Euphorie(Download)
        from euphorie.client.model import SurveySession
        from AccessControl.SecurityManagement import getSecurityManager
        from AccessControl.SecurityManagement import setSecurityManager
        from AccessControl.SecurityManagement import newSecurityManager
        setRequest(self.portal.REQUEST)
        finally:
            SurveySession.copySessionData = _copySessionData
            setSecurityManager(sm)
            setRequest(None)
 

src/e/r/erp5-HEAD/product/ERP5Type/tests/testDynamicClassGeneration.py   erp5(Download)
 
    from AccessControl.SecurityManagement import getSecurityManager
    from AccessControl.SecurityManagement import setSecurityManager
    from Products.CMFCore.WorkflowCore import WorkflowException
    sm = getSecurityManager()
                        test_component, 'delete_action')
    finally:
      setSecurityManager(sm)
 
    self.failIfModuleImportable('TestValidateInvalidateComponent')
                        test_component, 'delete_action')
    finally:
      setSecurityManager(sm)
 
    self.portal.portal_workflow.doActionFor(test_component, 'delete_action')

src/e/r/erp5-HEAD/product/ERP5Type/tests/ERP5TypeLiveTestCase.py   erp5(Download)
  # Test may login/logout with different users, so ensure that at the end the
  # original SecurityManager is restored
  from AccessControl.SecurityManagement import getSecurityManager, setSecurityManager
  sm = getSecurityManager()
  try:
    result = TestRunner(stream=output, verbosity=verbosity).run(suite)
  finally:
    setSecurityManager(sm)

Previous  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13  Next