Commit 0adf58da authored by Levin Zimmermann's avatar Levin Zimmermann

fixup! AlarmTool: handle automatic solve with alarms owned by system user

parent 5ee598ce
......@@ -29,6 +29,7 @@
from compiler.consts import CO_VARKEYWORDS
from DateTime import DateTime
from random import getrandbits
from AccessControl import ClassSecurityInfo, Unauthorized
from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager, newSecurityManager
......@@ -103,7 +104,7 @@ class Alarm(XMLObject, PeriodicityMixin):
return '%s_%s' % (self.getRelativeUrl(), id)
security.declareProtected(Permissions.AccessContentsInformation, 'activeSense')
def activeSense(self, fixit=0, params=None):
def activeSense(self, fixit=0, activate_kw=(), params=None):
"""
This method launches the sensing process as activities.
It is intended to launch a very long process made
......@@ -113,10 +114,9 @@ class Alarm(XMLObject, PeriodicityMixin):
The result of the sensing process can be obtained by invoking
the sense method or by requesting a report.
"""
portal_membership = self.getPortalObject().portal_membership
if fixit or not self.getEnabled():
checkPermission = portal_membership.checkPermission
if not checkPermission(Permissions.ManagePortal, self):
activate_kw = dict(activate_kw)
if (fixit or not self.getEnabled()) and not self.getPortalObject().portal_membership.checkPermission(Permissions.ManagePortal, self):
raise Unauthorized('fixing problems or activating a disabled alarm is not allowed')
# Use UnrestrictedMethod, so that the behavior would not
......
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