mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
user-find now works again, uses textui
This commit is contained in:
parent
42bf555a3a
commit
12dc0a0aa9
@ -252,7 +252,7 @@ class ldap(CrudBackend):
|
||||
result = self.retrieve(dn, ["*"])
|
||||
|
||||
entry = ipaldap.Entry((dn, servercore.convert_scalar_values(result)))
|
||||
|
||||
kw = dict(self.strip_none(kw))
|
||||
for k in kw:
|
||||
entry.setValues(k, kw[k])
|
||||
|
||||
|
@ -292,21 +292,26 @@ class user_find(crud.Find):
|
||||
else:
|
||||
kw['attributes'] = default_attributes
|
||||
return ldap.search(**kw)
|
||||
def output_for_cli(self, users):
|
||||
if not users:
|
||||
return
|
||||
counter = users[0]
|
||||
users = users[1:]
|
||||
if counter == 0:
|
||||
print "No entries found"
|
||||
return
|
||||
elif counter == -1:
|
||||
print "These results are truncated."
|
||||
print "Please refine your search and try again."
|
||||
|
||||
def output_for_cli(self, textui, result, uid, **options):
|
||||
counter = result[0]
|
||||
users = result[1:]
|
||||
if counter == 0 or len(users) == 0:
|
||||
textui.print_plain("No entries found")
|
||||
return
|
||||
if len(users) == 1:
|
||||
textui.print_entry(users[0])
|
||||
return
|
||||
textui.print_name(self.name)
|
||||
for u in users:
|
||||
display_user(u)
|
||||
print ""
|
||||
textui.print_plain('%(givenname)s %(sn)s:' % u)
|
||||
textui.print_entry(u)
|
||||
textui.print_plain('')
|
||||
if counter == -1:
|
||||
textui.print_plain('These results are truncated.')
|
||||
textui.print_plain('Please refine your search and try again.')
|
||||
textui.print_count(users, '%d users matched')
|
||||
|
||||
api.register(user_find)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user