Add terminate session to API

This commit is contained in:
JonnyWong16 2017-02-25 22:53:32 -08:00
parent 992f0baf93
commit cea851d38e
2 changed files with 58 additions and 0 deletions

View file

@ -280,6 +280,33 @@ class WebInterface(object):
logger.warn(u"Unable to retrieve data for get_current_activity_header.")
return serve_template(templatename="current_activity_header.html", data=None)
@cherrypy.expose
@cherrypy.tools.json_out()
@requireAuth(member_of("admin"))
@addtoapi()
def terminate_session(self, session_id=None, message=None, **kwargs):
""" Add a new notification agent.
```
Required parameters:
session_id (str): The id of the session to terminate
message (str): A custom message to send to the client
Optional parameters:
None
Returns:
None
```
"""
pms_connect = pmsconnect.PmsConnect()
result = pms_connect.terminate_session(session_id=session_id, message=message)
if result:
return {'result': 'success', 'message': 'Session terminated.'}
else:
return {'result': 'error', 'message': 'Failed to terminate session.'}
@cherrypy.expose
@requireAuth()
def home_stats(self, **kwargs):