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