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