Fixes https://fedorahosted.org/freeipa/ticket/5146

--
Martin^3 Babinsky
From 0f1cf3cc9b98a8ba1c3f3a1df990c0f717426806 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Thu, 23 Jul 2015 10:44:08 +0200
Subject: [PATCH] fix broken search for users by their manager

The patch fixes incorrect construction of search filter when using `ipa
user-find` with '--manager' option.

https://fedorahosted.org/freeipa/ticket/5146
---
 ipalib/plugins/baseuser.py | 8 ++++++++
 ipalib/plugins/user.py     | 4 ----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ipalib/plugins/baseuser.py b/ipalib/plugins/baseuser.py
index 9068ef0fd266a4460697ee45f29c80b74662fab2..bd66cf5a3e3a4e6c18d1a54408f969668c834fab 100644
--- a/ipalib/plugins/baseuser.py
+++ b/ipalib/plugins/baseuser.py
@@ -561,6 +561,14 @@ class baseuser_find(LDAPSearch):
     """
     Prototype command plugin to be implemented by real plugin
     """
+    def args_options_2_entry(self, *args, **options):
+        newoptions = {}
+        self.common_enhance_options(newoptions, **options)
+        options.update(newoptions)
+
+        return super(baseuser_find, self).args_options_2_entry(
+            *args, **options)
+
     def common_enhance_options(self, newoptions, **options):
         # assure the manager attr is a dn, not just a bare uid
         manager = options.get('manager')
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 9bd7bf7e5242234ead4c39a6346e57865b2e2124..206b380efb6472fb040dde33ac80e3f66c00c138 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -730,10 +730,6 @@ class user_find(baseuser_find):
             return ("(&(objectclass=posixaccount)(krbprincipalname=%s))"%\
                         getattr(context, 'principal'), base_dn, scope)
 
-        newoptions = {}
-        self.common_enhance_options(newoptions, **options)
-        options.update(newoptions)
-
         preserved = options.get('preserved', False)
         if preserved is None:
             base_dn = self.api.env.basedn
-- 
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