Commit da17232a authored by Aurel's avatar Aurel

add method isSuscribed to know if alarm tool is suscribed to timer service or not


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7666 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eb72769a
...@@ -68,12 +68,20 @@ class AlarmTool(BaseTool): ...@@ -68,12 +68,20 @@ class AlarmTool(BaseTool):
security.declareProtected( Permissions.ManagePortal , 'manageAlarmList' ) security.declareProtected( Permissions.ManagePortal , 'manageAlarmList' )
manageAlarmList = DTMLFile( 'manageAlarmList', _dtmldir ) manageAlarmList = DTMLFile( 'manageAlarmList', _dtmldir )
security.declareProtected( Permissions.ManagePortal , 'manageAlarmAdvanced' )
manageAlarmAdvanced = DTMLFile( 'manageAlarmAdvanced', _dtmldir )
manage_options = ( ( { 'label' : 'Overview' manage_options = ( ( { 'label' : 'Overview'
, 'action' : 'manage_overview' , 'action' : 'manage_overview'
} }
, { 'label' : 'All Alarms' , { 'label' : 'All Alarms'
, 'action' : 'manageAlarmList' , 'action' : 'manageAlarmList'
} }
, { 'label' : 'Advanced'
, 'action' : 'manageAlarmAdvanced'
}
,
) )
+ Folder.manage_options + Folder.manage_options
) )
...@@ -138,6 +146,22 @@ class AlarmTool(BaseTool): ...@@ -138,6 +146,22 @@ class AlarmTool(BaseTool):
continue continue
alarm.activate().activeSense() alarm.activate().activeSense()
security.declareProtected(Permissions.ManageProperties, 'isSubscribed')
def isSubscribed(self):
"""
return True, if we are subscribed to TimerService.
Otherwise return False.
"""
service = getTimerService(self)
if not service:
LOG('AlarmTool', INFO, 'TimerService not available')
return False
path = '/'.join(self.getPhysicalPath())
if path in service.lisSubscriptions():
return True
return False
security.declareProtected(Permissions.ManageProperties, 'subscribe') security.declareProtected(Permissions.ManageProperties, 'subscribe')
def subscribe(self): def subscribe(self):
""" """
......
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