当前位置: 首页>>代码示例>>Python>>正文


Python AccessControl.SecurityManager类代码示例

本文整理汇总了Python中AccessControl.SecurityManager的典型用法代码示例。如果您正苦于以下问题:Python SecurityManager类的具体用法?Python SecurityManager怎么用?Python SecurityManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SecurityManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testBoboTraverseToMethod

 def testBoboTraverseToMethod(self):
     # Verify it's possible to use __bobo_traverse__ to a method.
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     bb = BoboTraversable()
     self.failUnless(
         bb.restrictedTraverse('bb_method') is not bb.bb_method)
开发者ID:wpjunior,项目名称:proled,代码行数:7,代码来源:testTraverse.py

示例2: testBoboTraverseToSimpleAttrValue

 def testBoboTraverseToSimpleAttrValue(self):
     # Verify it's possible to use __bobo_traverse__ to a simple
     # python value
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     bb = BoboTraversable()
     self.assertEqual(bb.restrictedTraverse('bb_status'), 'screechy')
开发者ID:wpjunior,项目名称:proled,代码行数:7,代码来源:testTraverse.py

示例3: testDefaultValueWhenNotFound

 def testDefaultValueWhenNotFound(self):
     # Test that traversing to a non-existent object returns
     # the default when provided
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     self.assertEqual(
         self.root.restrictedTraverse('happy/happy', 'joy'), 'joy')
开发者ID:wpjunior,项目名称:proled,代码行数:7,代码来源:testTraverse.py

示例4: setUp

 def setUp( self ):
     get_transaction().begin()
     self._policy = UnitTestSecurityPolicy()
     SecurityManager.setSecurityPolicy(self._policy)
     self.connection = Zope.DB.open()
     self.root = self.connection.root()[ 'Application' ]
     newSecurityManager( None, UnitTestUser().__of__( self.root ) )
开发者ID:goschtl,项目名称:zope,代码行数:7,代码来源:test_PortalFolder.py

示例5: _setupSecurity

 def _setupSecurity(self, policy=None):
     from AccessControl import SecurityManager
     from AccessControl.SecurityManagement import noSecurityManager
     if policy is None:
         policy = self.oldPolicy
     noSecurityManager()
     SecurityManager.setSecurityPolicy(policy)
开发者ID:zopefoundation,项目名称:Zope,代码行数:7,代码来源:testTraverse.py

示例6: testTraverseThroughBoboTraverse

 def testTraverseThroughBoboTraverse(self):
     # Verify it's possible to use __bobo_traverse__ with the
     # Zope security policy.
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     bb = BoboTraversable()
     self.failUnlessRaises(KeyError, bb.restrictedTraverse, 'notfound')
     bb.restrictedTraverse('bb_subitem')
开发者ID:OS2World,项目名称:APP-SERVER-Zope,代码行数:8,代码来源:testTraverse.py

示例7: testDefaultValueWhenUnathorized

 def testDefaultValueWhenUnathorized(self):
     # Test that traversing to an unauthorized object returns
     # the default when provided
     noSecurityManager()
     SecurityManager.setSecurityPolicy(CruelSecurityPolicy())
     newSecurityManager( None, UnitTestUser().__of__( self.root ) )
     self.root.stuff = 'stuff here'
     self.assertEqual(
         self.root.folder1.restrictedTraverse('stuff', 42), 42)
开发者ID:wpjunior,项目名称:proled,代码行数:9,代码来源:testTraverse.py

示例8: tearDown

    def tearDown(self):
        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldPolicy)
        del self.oldPolicy
        del self.policy
        del self.folder2
        del self.folder1

        self._cleanApp()
开发者ID:dhavlik,项目名称:Zope,代码行数:9,代码来源:testCopySupport.py

示例9: tearDown

    def tearDown(self):
        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldpolicy)

        del self.root
        del self.reflecto
        del self.oldpolicy

        super(CopyPasteTests, self).tearDown()
开发者ID:FHNW,项目名称:Products.Reflecto,代码行数:9,代码来源:testDirectory.py

示例10: testBoboTraverseToNonAttrValue

 def testBoboTraverseToNonAttrValue(self):
     # Verify it's possible to use __bobo_traverse__ to an
     # arbitrary manufactured object
     noSecurityManager()
     # Default security policy always seems to deny in this case, which
     # is fine, but to test the code branch we sub in the forgiving one
     SecurityManager.setSecurityPolicy(UnitTestSecurityPolicy())
     bb = BoboTraversable()
     self.failUnless(
         bb.restrictedTraverse('manufactured') is 42)
开发者ID:wpjunior,项目名称:proled,代码行数:10,代码来源:testTraverse.py

示例11: tearDown

 def tearDown( self ):
     del self.types_tool
     del self.workflow_tool
     del self.url_tool
     del self.discussion_tool
     del self.catalog_tool
     del self.root
     del self._policy
     get_transaction().abort()
     self.connection.close()
     SecurityManager.setSecurityPolicy( self._oldPolicy )
开发者ID:goschtl,项目名称:zope,代码行数:11,代码来源:test_Discussions.py

示例12: testBoboTraverseToAcquiredAttribute

 def testBoboTraverseToAcquiredAttribute(self):
     # Verify it's possible to use __bobo_traverse__ to an acquired
     # attribute
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     folder = self.root.folder1
     folder.stuff = 'stuff here'
     bb = BoboTraversableWithAcquisition()
     bb = bb.__of__(folder)
     self.assertEqual(
         bb.restrictedTraverse('stuff'), 'stuff here')
开发者ID:wpjunior,项目名称:proled,代码行数:11,代码来源:testTraverse.py

示例13: testAcquiredAttributeDenial

 def testAcquiredAttributeDenial(self):
     # Verify that restrictedTraverse raises the right kind of exception
     # on denial of access to an acquired attribute.  If it raises
     # AttributeError instead of Unauthorized, the user may never
     # be prompted for HTTP credentials.
     noSecurityManager()
     SecurityManager.setSecurityPolicy(CruelSecurityPolicy())
     newSecurityManager( None, UnitTestUser().__of__( self.root ) )
     self.root.stuff = 'stuff here'
     self.failUnlessRaises(Unauthorized,
                           self.root.folder1.restrictedTraverse, 'stuff')
开发者ID:OS2World,项目名称:APP-SERVER-Zope,代码行数:11,代码来源:testTraverse.py

示例14: tearDown

    def tearDown(self):

        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldPolicy)
        del self.oldPolicy
        del self.policy
        del self.folder2
        del self.folder1

        self._cleanApp()
        componenttesting.tearDown()
        CopySupportTestBase.tearDown(self)
开发者ID:pigaov10,项目名称:plone4.3,代码行数:12,代码来源:test_CacheManagerLocation.py

示例15: testBoboTraverseToAcquiredProtectedObject

 def testBoboTraverseToAcquiredProtectedObject(self):
     # Verify it's possible to use a __bobo_traverse__ which retrieves
     # objects by acquisition
     noSecurityManager()
     SecurityManager.setSecurityPolicy( self.oldPolicy )
     folder = self.root.folder1
     # restrict the ability to access the retrieved object itself
     folder.manage_permission(access_contents_information, [], 0)
     bb = BoboTraversableWithAcquisition()
     bb = bb.__of__(self.root)
     self.failUnlessRaises(Unauthorized,
                           self.root.folder1.restrictedTraverse, 'folder1')
开发者ID:wpjunior,项目名称:proled,代码行数:12,代码来源:testTraverse.py


注:本文中的AccessControl.SecurityManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。