590d18
From 29d63aa08fc648c3dfbc9ae4cc74991eba2fb7a0 Mon Sep 17 00:00:00 2001
590d18
From: Martin Babinsky <mbabinsk@redhat.com>
590d18
Date: Thu, 23 Jul 2015 10:44:08 +0200
590d18
Subject: [PATCH] fix broken search for users by their manager
590d18
590d18
The patch fixes incorrect construction of search filter when using `ipa
590d18
user-find` with '--manager' option.
590d18
590d18
https://fedorahosted.org/freeipa/ticket/5146
590d18
590d18
Reviewed-By: Tomas Babej <tbabej@redhat.com>
590d18
---
590d18
 ipalib/plugins/baseuser.py  | 8 ++++++++
590d18
 ipalib/plugins/stageuser.py | 7 -------
590d18
 ipalib/plugins/user.py      | 4 ----
590d18
 3 files changed, 8 insertions(+), 11 deletions(-)
590d18
590d18
diff --git a/ipalib/plugins/baseuser.py b/ipalib/plugins/baseuser.py
590d18
index 9068ef0fd266a4460697ee45f29c80b74662fab2..bd66cf5a3e3a4e6c18d1a54408f969668c834fab 100644
590d18
--- a/ipalib/plugins/baseuser.py
590d18
+++ b/ipalib/plugins/baseuser.py
590d18
@@ -561,6 +561,14 @@ class baseuser_find(LDAPSearch):
590d18
     """
590d18
     Prototype command plugin to be implemented by real plugin
590d18
     """
590d18
+    def args_options_2_entry(self, *args, **options):
590d18
+        newoptions = {}
590d18
+        self.common_enhance_options(newoptions, **options)
590d18
+        options.update(newoptions)
590d18
+
590d18
+        return super(baseuser_find, self).args_options_2_entry(
590d18
+            *args, **options)
590d18
+
590d18
     def common_enhance_options(self, newoptions, **options):
590d18
         # assure the manager attr is a dn, not just a bare uid
590d18
         manager = options.get('manager')
590d18
diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
590d18
index 6cbc8f4ab07f2c1172f2b2c45bfe8f30a74938b3..49a762a922b21bd6d0824787d9305417f5e47ee6 100644
590d18
--- a/ipalib/plugins/stageuser.py
590d18
+++ b/ipalib/plugins/stageuser.py
590d18
@@ -449,13 +449,6 @@ class stageuser_find(baseuser_find):
590d18
     member_attributes = ['memberof']
590d18
     has_output_params = baseuser_find.has_output_params + stageuser_output_params
590d18
 
590d18
-    def execute(self, *args, **options):
590d18
-        newoptions = {}
590d18
-        self.common_enhance_options(newoptions, **options)
590d18
-        options.update(newoptions)
590d18
-
590d18
-        return super(stageuser_find, self).execute(self, *args, **options)
590d18
-
590d18
     def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *keys, **options):
590d18
         assert isinstance(base_dn, DN)
590d18
 
590d18
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
590d18
index 9bd7bf7e5242234ead4c39a6346e57865b2e2124..206b380efb6472fb040dde33ac80e3f66c00c138 100644
590d18
--- a/ipalib/plugins/user.py
590d18
+++ b/ipalib/plugins/user.py
590d18
@@ -730,10 +730,6 @@ class user_find(baseuser_find):
590d18
             return ("(&(objectclass=posixaccount)(krbprincipalname=%s))"%\
590d18
                         getattr(context, 'principal'), base_dn, scope)
590d18
 
590d18
-        newoptions = {}
590d18
-        self.common_enhance_options(newoptions, **options)
590d18
-        options.update(newoptions)
590d18
-
590d18
         preserved = options.get('preserved', False)
590d18
         if preserved is None:
590d18
             base_dn = self.api.env.basedn
590d18
-- 
590d18
2.4.3
590d18