freeipa/ipaserver/plugins/session.py
Jan Cholasta dcf8b47471 session: move the session module from ipalib to ipaserver
The module is used only on the server, so there's no need to have it in
ipalib, which is shared by client and server.

https://fedorahosted.org/freeipa/ticket/5988

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2016-06-30 14:09:24 +02:00

34 lines
901 B
Python

#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
from ipalib import api, Command
from ipalib.request import context
from ipalib.plugable import Registry
if api.env.in_server:
from ipaserver.session import session_mgr
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
session_mgr.auth_mgr.logout(session_data)
return dict(result=None)