On 07/08/2015 10:37 AM, Petr Vobornik wrote:
API refactoring caused that session_logout command was not registered.

Commands in ipalib/plugins directory are automatically registered.



Added NO_CLI = True to hide the command in CLI.
--
Petr Vobornik
From 6cc9e7f3ff601735887ef566ea02e04a676041ef Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Wed, 8 Jul 2015 10:32:54 +0200
Subject: [PATCH] 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.
---
 ipalib/plugins/session.py | 31 +++++++++++++++++++++++++++++++
 ipalib/session.py         | 29 -----------------------------
 2 files changed, 31 insertions(+), 29 deletions(-)
 create mode 100644 ipalib/plugins/session.py

diff --git a/ipalib/plugins/session.py b/ipalib/plugins/session.py
new file mode 100644
index 0000000000000000000000000000000000000000..3fd566d3224a13b5fbaa4450f02855329a13bc4c
--- /dev/null
+++ b/ipalib/plugins/session.py
@@ -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)
diff --git a/ipalib/session.py b/ipalib/session.py
index 2f732b333375c837b931c6b16ccfc535e11d7e4c..ec6c2081c65678dc1e75ab957564ace906b68252 100644
--- a/ipalib/session.py
+++ b/ipalib/session.py
@@ -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()
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to