mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use same labels as UI for ipa-finduser and ipa-findgroup
Add -a option to ipa-findgroup to print all attributes
This commit is contained in:
@@ -35,6 +35,12 @@ def usage():
|
||||
def parse_options():
|
||||
parser = OptionParser()
|
||||
|
||||
parser.add_option("-a", "--all", action="store_true", dest="all",
|
||||
help="Show all group attributes")
|
||||
parser.add_option("-n", "--notranslate", action="store_true",
|
||||
dest="notranslate",
|
||||
help="Don't translate LDAP attributes into readable labels")
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
@@ -49,7 +55,10 @@ def main():
|
||||
|
||||
try:
|
||||
client = ipaclient.IPAClient()
|
||||
groups = client.find_groups(args[1], ['cn','description','gidnumber'])
|
||||
if options.all is None:
|
||||
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
||||
else:
|
||||
groups = client.find_groups(args[1], sattrs=['*','nsAccountLock'])
|
||||
|
||||
counter = groups[0]
|
||||
groups = groups[1:]
|
||||
@@ -65,15 +74,21 @@ def main():
|
||||
print str(e)
|
||||
continue
|
||||
attr = ent.attrList()
|
||||
if options.notranslate:
|
||||
labels = {}
|
||||
for a in attr:
|
||||
labels[a] = a
|
||||
else:
|
||||
labels = client.attrs_to_labels(attr)
|
||||
|
||||
print "dn: " + ent.dn
|
||||
|
||||
for a in attr:
|
||||
value = ent.getValues(a)
|
||||
if isinstance(value,str):
|
||||
print a + ": " + value
|
||||
print labels[a] + ": " + value
|
||||
else:
|
||||
print a + ": "
|
||||
print labels[a] + ": "
|
||||
for l in value:
|
||||
print "\t" + l
|
||||
|
||||
|
||||
Reference in New Issue
Block a user