Commit bd074d62 authored by Jérome Perrin's avatar Jérome Perrin

store security manager and reset it afterwards rather than looking up again the

user and login. This should be a bit faster.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17507 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3b5f5951
...@@ -186,16 +186,14 @@ class Message: ...@@ -186,16 +186,14 @@ class Message:
def __call__(self, activity_tool): def __call__(self, activity_tool):
try: try:
obj = self.getObject(activity_tool) obj = self.getObject(activity_tool)
# Change user if required (TO BE DONE) old_security_manager = getSecurityManager()
# We will change the user only in order to execute this method # We will change the user only in order to execute this method
current_user = str(_getAuthenticatedUser(self))
user = self.changeUser(self.user_name, activity_tool) user = self.changeUser(self.user_name, activity_tool)
try: try:
result = getattr(obj, self.method_id)(*self.args, **self.kw) result = getattr(obj, self.method_id)(*self.args, **self.kw)
finally: finally:
# Use again the previous user setSecurityManager(old_security_manager)
if user is not None:
self.changeUser(current_user, activity_tool)
self.activateResult(activity_tool, result, obj) self.activateResult(activity_tool, result, obj)
self.is_executed = 1 self.is_executed = 1
except: except:
......
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