diff options
-rw-r--r-- | ipalib/plugins/user.py | 7 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_user_plugin.py | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index 529699f9a..6a7f53fde 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -628,6 +628,13 @@ class user_find(LDAPSearch): ), ) + def execute(self, *args, **options): + # assure the manager attr is a dn, not just a bare uid + manager = options.get('manager') + if manager is not None: + options['manager'] = self.obj._normalize_manager(manager) + return super(user_find, self).execute(self, *args, **options) + def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *keys, **options): assert isinstance(base_dn, DN) if options.get('whoami'): diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py index 4a4c69c19..5fdf365c8 100644 --- a/tests/test_xmlrpc/test_user_plugin.py +++ b/tests/test_xmlrpc/test_user_plugin.py @@ -662,6 +662,33 @@ class test_user(Declarative): ), ), + dict( + desc='Search for "%s" with manager "%s"' % (user2, user1), + command=( + 'user_find', [user2], {'manager': user1} + ), + expected=dict( + result=[ + dict( + dn=get_user_dn(user2), + givenname=[u'Test'], + homedirectory=[u'/home/tuser2'], + loginshell=[u'/bin/sh'], + sn=[u'User2'], + uid=[user2], + nsaccountlock=False, + has_keytab=False, + has_password=False, + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + manager=[user1], + ), + ], + summary=u'1 user matched', + count=1, + truncated=False, + ), + ), dict( desc='Delete %r and %r at the same time' % (user1, user2), |