Commit ce5f08fd authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: make script with proxy roles usable as a grouping method

parent 89185deb
......@@ -453,6 +453,7 @@ class GroupedMessage(object):
# XXX: Allowing restricted code to implement a grouping method is questionable
# but there already exist some.
__parent__ = property(lambda self: self.object) # for object
_guarded_writes = 1 # for result
allow_class(GroupedMessage)
......
......@@ -3106,12 +3106,15 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
def test_restrictedGroupMethod(self):
skin = self.portal.portal_skins.custom
script_id = self.id()
createZODBPythonScript(skin, script_id, "message_list", """if 1:
script = createZODBPythonScript(skin, script_id, "message_list", """if 1:
for m in message_list:
m.result = m.object.getProperty(*m.args, **m.kw)
""")
script.manage_proxy(("Manager",))
obj = self.portal.portal_activities.newActiveProcess(causality_value_list=(
self.portal.person_module, self.portal.organisation_module))
obj.manage_permission('Access contents information', ['Manager'])
self.logout()
foo = obj.activate(activity='SQLQueue',
group_method_id=script_id,
active_process=obj.getPath()).foo
......
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