move session_logout command to ipalib/plugins directory
API refactoring caused that session_logout command was not registered. Commands in ipalib/plugins directory are automatically registered. Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
9c5df3cf76
commit
cd3ca94ff2
4 files changed
+37
-31
No files matched your search
@@ -4201,6 +4201,10 @@ option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: session_logout
|
||||
args: 0,1,1
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('result', None, None)
|
||||
command: sidgen_was_run
|
||||
args: 0,1,1
|
||||
option: Str('version?', exclude='webui')
|
||||
|
||||
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
|
||||
# #
|
||||
########################################################
|
||||
IPA_API_VERSION_MAJOR=2
|
||||
IPA_API_VERSION_MINOR=145
|
||||
# Last change: edewata - added vault access control
|
||||
IPA_API_VERSION_MINOR=146
|
||||
# Last change: pvoborni - move session_logout to ipalib/plugins
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
from ipalib import Command
|
||||
from ipalib.request import context
|
||||
from ipalib.session import session_mgr
|
||||
from ipalib.plugable import Registry
|
||||
|
||||
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)
|
||||
@@ -26,7 +26,6 @@ from urllib2 import urlparse
|
||||
from text import _
|
||||
from ipapython.ipa_log_manager import *
|
||||
from ipalib import api, errors
|
||||
from ipalib import Command
|
||||
from ipaplatform.paths import paths
|
||||
from ipalib.krb_utils import *
|
||||
from ipapython.cookie import Cookie
|
||||
@@ -1278,32 +1277,4 @@ def release_ipa_ccache(ccache_name):
|
||||
else:
|
||||
raise ValueError('ccache scheme "%s" unsupported (%s)', scheme, ccache_name)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
from ipalib.request import context
|
||||
|
||||
class session_logout(Command):
|
||||
'''
|
||||
RPC command used to log the current user out of their session.
|
||||
'''
|
||||
|
||||
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)
|
||||
|
||||
api.register(session_logout)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
session_mgr = MemcacheSessionManager()
|
||||
Reference in new issue
Block a user