Commit 0fbc3f6c authored by Jérome Perrin's avatar Jérome Perrin

core: fix edit_workflow/edit permission

This transition should not be more restrictive that the original
method ie. 'Modify portal content' for "real" documents and public
for temp objects.
parent d17614c7
Pipeline #21746 failed with stage
......@@ -274,9 +274,25 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
o = portal.organisation_module.newContent(portal_type='Organisation',
temp_object=1)
self.assertEqual(o.isTempObject(), 1)
a = o.newContent(portal_type = 'Telephone')
guarded_getattr(o, 'edit')(title='temp object')
self.assertEqual(guarded_getattr(o, 'getTitle')(), 'temp object')
# a temp object which acquire local roles, in temp container
o.manage_permission('Modify portal content', [])
o.manage_permission('Add portal content', [])
a = o.newContent(portal_type='Telephone')
self.assertEqual(a.isTempObject(), 1)
self.assertEqual(a, guarded_getattr(o, a.getId()))
guarded_getattr(a, 'edit')(title='temp object')
self.assertEqual(guarded_getattr(a, 'getTitle')(), 'temp object')
# a temp object which does not acquire local roles, in a temp container
b = o.newContent(portal_type='Telephone')
self.assertEqual(b.isTempObject(), 1)
self.assertEqual(b, guarded_getattr(o, b.getId()))
guarded_getattr(b, 'edit')(title='temp object')
self.assertEqual(guarded_getattr(b, 'getTitle')(), 'temp object')
self.logout()
self.login()
......
......@@ -48,6 +48,10 @@
<key> <string>description</string> </key>
<value> <string>action called when editing a document</string> </value>
</item>
<item>
<key> <string>guard_expression</string> </key>
<value> <string>python: object.getPortalObject().portal_membership.checkPermission(\'Modify portal content\', object) or object.isTempObject()</string> </value>
</item>
<item>
<key> <string>guard_group</string> </key>
<value>
......@@ -57,9 +61,7 @@
<item>
<key> <string>guard_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment