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

AlarmTool: restore security manager after tic

parent 0edd03d9
...@@ -30,7 +30,8 @@ import time ...@@ -30,7 +30,8 @@ import time
import threading import threading
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import getSecurityManager, \
newSecurityManager, setSecurityManager
from Products.ERP5Type.Globals import InitializeClass, DTMLFile, PersistentMapping from Products.ERP5Type.Globals import InitializeClass, DTMLFile, PersistentMapping
from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
...@@ -128,14 +129,18 @@ class AlarmTool(TimerServiceMixin, BaseTool): ...@@ -128,14 +129,18 @@ class AlarmTool(TimerServiceMixin, BaseTool):
We will look at all alarms and see if they should be activated, We will look at all alarms and see if they should be activated,
if so then we will activate them. if so then we will activate them.
""" """
for alarm in self.getAlarmList(to_active=1): security_manager = getSecurityManager()
if alarm is not None: try:
user = alarm.getWrappedOwner() for alarm in self.getAlarmList(to_active=1):
newSecurityManager(self.REQUEST, user) if alarm is not None:
if alarm.isActive() or not alarm.isEnabled(): user = alarm.getWrappedOwner()
# do nothing if already active, or not enabled newSecurityManager(self.REQUEST, user)
continue if alarm.isActive() or not alarm.isEnabled():
alarm.activeSense() # do nothing if already active, or not enabled
continue
alarm.activeSense()
finally:
setSecurityManager(security_manager)
security.declarePrivate('process_timer') security.declarePrivate('process_timer')
def process_timer(self, interval, tick, prev="", next=""): def process_timer(self, interval, tick, prev="", next=""):
......
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