本文整理汇总了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)))
示例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)))