2015-07-08 03:32:54 -05:00
|
|
|
#
|
|
|
|
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
|
|
|
#
|
|
|
|
|
2016-06-29 08:53:52 -05:00
|
|
|
from ipalib import Command
|
2015-07-08 03:32:54 -05:00
|
|
|
from ipalib.request import context
|
|
|
|
from ipalib.plugable import Registry
|
2016-06-29 08:53:52 -05:00
|
|
|
from ipaserver.session import get_session_mgr
|
2015-07-16 03:17:26 -05:00
|
|
|
|
2015-07-08 03:32:54 -05:00
|
|
|
register = Registry()
|
|
|
|
|
|
|
|
|
|
|
|
@register()
|
|
|
|
class session_logout(Command):
|
|
|
|
'''
|
|
|
|
RPC command used to log the current user out of their session.
|
|
|
|
'''
|
|
|
|
NO_CLI = True
|
|
|
|
|
|
|
|
def execute(self, *args, **options):
|
|
|
|
session_data = getattr(context, 'session_data', None)
|
|
|
|
if session_data is None:
|
|
|
|
self.debug('session logout command: no session_data found')
|
|
|
|
else:
|
|
|
|
session_id = session_data.get('session_id')
|
|
|
|
self.debug('session logout command: session_id=%s', session_id)
|
|
|
|
|
|
|
|
# Notifiy registered listeners
|
2016-06-29 08:53:52 -05:00
|
|
|
session_mgr = get_session_mgr()
|
2015-07-08 03:32:54 -05:00
|
|
|
session_mgr.auth_mgr.logout(session_data)
|
|
|
|
|
|
|
|
return dict(result=None)
|