diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-10-07 06:15:34 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-10-07 06:15:34 -0400 |
commit | db9d8dd3e0924bb9c7f9c89a56e6b6057dabc710 (patch) | |
tree | 6b7cae394a0457bbcc3f87e5745f0fdfc4cf1ccf /ipalib/plugins | |
parent | e012e860b472bcb5a00a089e73113fb6989fde20 (diff) | |
download | freeipa-db9d8dd3e0924bb9c7f9c89a56e6b6057dabc710.tar.gz freeipa-db9d8dd3e0924bb9c7f9c89a56e6b6057dabc710.tar.xz freeipa-db9d8dd3e0924bb9c7f9c89a56e6b6057dabc710.zip |
Implement a real user_find and move existing user_find to user_show
Diffstat (limited to 'ipalib/plugins')
-rw-r--r-- | ipalib/plugins/f_user.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/ipalib/plugins/f_user.py b/ipalib/plugins/f_user.py index 0b424d351..e560d03ce 100644 --- a/ipalib/plugins/f_user.py +++ b/ipalib/plugins/f_user.py @@ -208,15 +208,33 @@ class user_find(crud.Find): 'Search the users.' def execute(self, *args, **kw): uid=args[0] - result = servercore.get_sub_entry(servercore.basedn, "uid=%s" % uid, ["*"]) + result = servercore.find_users(uid, ["*"]) return result def forward(self, *args, **kw): - result = super(crud.Find, self).forward(*args, **kw) - for a in result: - print a, ": ", result[a] + users = super(crud.Find, self).forward(*args, **kw) + counter = users[0] + users = users[1:] + if counter == 0: + print "No entries found for", args[0] + return + elif counter == -1: + print "These results are truncated." + print "Please refine your search and try again." + + for u in users: + for a in u.keys(): + print "%s: %s" % (a, u[a]) api.register(user_find) class user_show(crud.Get): 'Examine an existing user.' + def execute(self, *args, **kw): + uid=args[0] + result = servercore.get_user_by_uid(uid, ["*"]) + return result + def forward(self, *args, **kw): + result = super(crud.Get, self).forward(*args, **kw) + for a in result: + print a, ": ", result[a] api.register(user_show) |