Commit ce4144ca authored by Sebastien Robin's avatar Sebastien Robin

- improve security settings of Alarm Tool


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24500 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 06214a3f
...@@ -185,10 +185,12 @@ class AlarmTool(BaseTool): ...@@ -185,10 +185,12 @@ class AlarmTool(BaseTool):
service.unsubscribe(self) service.unsubscribe(self)
return "Usubscribed from Timer Service" return "Usubscribed from Timer Service"
security.declareProtected(Permissions.ManageProperties, 'manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
self.unsubscribe() self.unsubscribe()
BaseTool.inheritedAttribute('manage_beforeDelete')(self, item, container) BaseTool.inheritedAttribute('manage_beforeDelete')(self, item, container)
security.declareProtected(Permissions.ManageProperties, 'manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
self.subscribe() self.subscribe()
BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container) BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container)
...@@ -219,6 +221,7 @@ class AlarmTool(BaseTool): ...@@ -219,6 +221,7 @@ class AlarmTool(BaseTool):
finally: finally:
last_tic_lock.release() last_tic_lock.release()
security.declarePublic('getCurrentNode')
def getCurrentNode(self): def getCurrentNode(self):
""" Return current node in form ip:port """ """ Return current node in form ip:port """
global current_node global current_node
...@@ -241,6 +244,7 @@ class AlarmTool(BaseTool): ...@@ -241,6 +244,7 @@ class AlarmTool(BaseTool):
""" Return the alarmNode """ """ Return the alarmNode """
return self.alarmNode return self.alarmNode
security.declareProtected(Permissions.ManageProperties, 'setAlarmNode')
def setAlarmNode(self, alarm_node): def setAlarmNode(self, alarm_node):
""" """
When alarm_node evaluates to false, set a None value: When alarm_node evaluates to false, set a None value:
...@@ -256,7 +260,7 @@ class AlarmTool(BaseTool): ...@@ -256,7 +260,7 @@ class AlarmTool(BaseTool):
"""Check we have been provided a good node name""" """Check we have been provided a good node name"""
return isinstance(node_name, str) and NODE_RE.match(node_name) return isinstance(node_name, str) and NODE_RE.match(node_name)
security.declarePublic('manage_setAlarmNode') security.declareProtected(Permissions.ManageProperties, 'manage_setAlarmNode')
def manage_setAlarmNode(self, alarmNode, REQUEST=None): def manage_setAlarmNode(self, alarmNode, REQUEST=None):
""" set the alarm node """ """ set the alarm node """
if not alarmNode or self._isValidNodeName(alarmNode): if not alarmNode or self._isValidNodeName(alarmNode):
......
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