Commit 0accb3ef authored by Vincent Pelletier's avatar Vincent Pelletier

CMFActivity: Set transaction user and note when executing Message.

In normal Zope usage, ZPublisher does this. TimerServer does not provide
publisher with a request (which would be irrelevant anyway), so
CMFActivity-managed transactions notes are empty.
Notes are useful to identify the cause of an object modification, so set
them in CMFActivity.
parent 2ef591e3
......@@ -56,6 +56,7 @@ from BTrees.OIBTree import OIBTree
from Zope2 import app
from Products.ERP5Type.UnrestrictedMethod import PrivilegedUser
from zope.site.hooks import setSite
import transaction
import Products.Localizer.patches
localizer_lock = Products.Localizer.patches._requests_lock
......@@ -286,6 +287,7 @@ class Message(BaseMessage):
if user is not None:
user = user.__of__(uf)
newSecurityManager(None, user)
transaction.get().setUser(user_name, '/'.join(uf.getPhysicalPath()))
else :
LOG("CMFActivity", WARNING,
"Unable to find user %r in the portal" % user_name)
......@@ -311,6 +313,9 @@ class Message(BaseMessage):
# XXX: There is no check to see if user is allowed to access
# that method !
method = getattr(obj, self.method_id)
transaction.get().note(
'CMFActivity ' + '/'.join(self.object_path) + '/' + self.method_id
)
# Store site info
setSite(activity_tool.getParentValue())
if activity_tool.activity_timing_log:
......
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