On 07/08/2015 01:20 PM, Martin Basti wrote:
On 08/07/15 12:51, Martin Basti wrote:
On 08/07/15 12:20, Petr Vobornik wrote:
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.


ercategory

User category the ACL applies to


Added NO_CLI = True to hide the command in CLI.


Works for me.

--
Martin Basti


NACK, It works but you should update API.txt

Command session_logout in ipalib, not in API

There are one or more new commands defined.
Update API.txt and increment the minor version in VERSION.


updated patch attached.
--
Petr Vobornik
From 20caa29033418617c94066e6b0f94fce0aba86d1 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.
---
 API.txt                   |  4 ++++
 VERSION                   |  4 ++--
 ipalib/plugins/session.py | 31 +++++++++++++++++++++++++++++++
 ipalib/session.py         | 29 -----------------------------
 4 files changed, 37 insertions(+), 31 deletions(-)
 create mode 100644 ipalib/plugins/session.py

diff --git a/API.txt b/API.txt
index d4eb074bf3ca22b249e85336f21cb7a3c557f39d..c68bee94e3a9ed6182f6bd2152070222e32c7532 100644
--- a/API.txt
+++ b/API.txt
@@ -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')
diff --git a/VERSION b/VERSION
index 38af6ec593cef90e03cfc532038c959ae23a45f5..f67ec791a278b568ee633bf6c65e5a2f5c389cc0 100644
--- a/VERSION
+++ b/VERSION
@@ -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
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