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


Python DummyContent.manage_permission方法代码示例

本文整理汇总了Python中Products.CMFCore.tests.base.dummy.DummyContent.manage_permission方法的典型用法代码示例。如果您正苦于以下问题:Python DummyContent.manage_permission方法的具体用法?Python DummyContent.manage_permission怎么用?Python DummyContent.manage_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.CMFCore.tests.base.dummy.DummyContent的用法示例。


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

示例1: test_doActionFor_mixture

# 需要导入模块: from Products.CMFCore.tests.base.dummy import DummyContent [as 别名]
# 或者: from Products.CMFCore.tests.base.dummy.DummyContent import manage_permission [as 别名]
    def test_doActionFor_mixture(self):

        wftool = self.site.portal_workflow
        wf = self._getDummyWorkflow()
        
        # This time, disallow Authenticated and Manager
        wf.states['confidential'].permission_roles = {'View': ('Authenticated', 'Manager'),}
       
        dummy = DummyContent() 
        
        # Now, if the item is normally granted to these roles
        dummy.manage_permission('View', ['Authenticated', 'Manager', 'Owner',], acquire=1)

        dummy = self.site._setObject('dummy', dummy)
        
        # These are the roles we know about
        self.assertEqual(['Anonymous', 'Authenticated', 'Manager', 'Owner'], sorted(dummy.validRoles()))
        
        self.assertEqual(wf._getStatusOf(dummy),
                         {'state': 'nonconfidential', 'comments': ''})
        
        # Then in the non-confidential state (no permissions ticked) we still have that role
        self.assertEquals(['Authenticated', 'Manager', 'Owner'], sorted(rolesForPermissionOn('View', dummy)))
                          
        wf.doActionFor(dummy, 'make_confidential', comment='foo' )
        self.assertEqual(wf._getStatusOf(dummy),
                         {'state': 'confidential', 'comments': 'foo'})
        
        # But after moving to confidential, which disallows Anonymous and Authenticated,
        # we are left with Owner and Manager
        self.assertEquals(['Owner'], sorted(rolesForPermissionOn('View', dummy)))
开发者ID:collective,项目名称:collective.subtractiveworkflow,代码行数:33,代码来源:test_permissions.py

示例2: test_doActionFor_anonymous

# 需要导入模块: from Products.CMFCore.tests.base.dummy import DummyContent [as 别名]
# 或者: from Products.CMFCore.tests.base.dummy.DummyContent import manage_permission [as 别名]
    def test_doActionFor_anonymous(self):

        wftool = self.site.portal_workflow
        wf = self._getDummyWorkflow()

        dummy = DummyContent()
        
        # Now, if the item is normally granted to anonymous...
        dummy.manage_permission('View', ['Anonymous'], acquire=1)

        dummy = self.site._setObject('dummy', dummy)
        
        # These are the roles we know about
        self.assertEquals(['Anonymous', 'Authenticated', 'Manager', 'Owner'], sorted(dummy.validRoles()))
        
        self.assertEqual( wf._getStatusOf(dummy),
                          {'state': 'confidential', 'comments': ''} )
        
        self.assertEquals(['Manager', 'Owner'], sorted(rolesForPermissionOn('View', dummy)))
开发者ID:collective,项目名称:collective.subtractiveworkflow,代码行数:21,代码来源:test_permissions.py


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