mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-28 01:41:14 -06:00
Add option to list common attributes for use with --setattr,--addattr,--delattr
This commit is contained in:
parent
64cce8f82e
commit
5834ada3e9
@ -34,7 +34,8 @@ import ldap
|
||||
import errno
|
||||
|
||||
def usage():
|
||||
print "ipa-adddelgation [-a|--attributes attr1,attr2,..,attrn] [-l|--list] [-s|--source STRING] [-t|--target STRING] name"
|
||||
print "ipa-adddelegation [-l|--list]"
|
||||
print "ipa-adddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
|
||||
sys.exit(1)
|
||||
|
||||
def parse_options():
|
||||
|
@ -37,13 +37,16 @@ import errno
|
||||
aci_fields = ['*', 'aci']
|
||||
|
||||
def usage():
|
||||
print "ipa-moddelgation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
|
||||
print "ipa-moddelegation [-l|--list]"
|
||||
print "ipa-moddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
|
||||
sys.exit(1)
|
||||
|
||||
def parse_options():
|
||||
parser = OptionParser()
|
||||
parser.add_option("-a", "--attributes", dest="attributes",
|
||||
help="The attributes the source group may change in the target group")
|
||||
parser.add_option("-l", "--list", dest="list", action="store_true",
|
||||
help="List common attributes (this is not an exhaustive list)")
|
||||
parser.add_option("-s", "--source", dest="source",
|
||||
help="The source group name")
|
||||
parser.add_option("-t", "--target", dest="target",
|
||||
@ -60,11 +63,18 @@ def main():
|
||||
|
||||
options, args = parse_options()
|
||||
|
||||
if options.list:
|
||||
client = ipaclient.IPAClient()
|
||||
list = client.get_all_attrs()
|
||||
|
||||
for x in list:
|
||||
print x
|
||||
return 0
|
||||
|
||||
if options.usage or len(args) != 2:
|
||||
usage()
|
||||
|
||||
if not options.attributes and not options.source and not options.target:
|
||||
print "Missing something"
|
||||
usage()
|
||||
|
||||
try:
|
||||
|
@ -32,6 +32,7 @@ import ldap
|
||||
import errno
|
||||
|
||||
def usage():
|
||||
print "ipa-modgroup [-l|--list]"
|
||||
print "ipa-modgroup [-a|--add] [-r|--remove] user group"
|
||||
print "ipa-modgroup [-d|--desc description STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] group"
|
||||
sys.exit(1)
|
||||
@ -55,6 +56,8 @@ def parse_options():
|
||||
parser.add_option("--setattr", dest="setattr",
|
||||
help="Set an attribute, dropping any existing values that may exist",
|
||||
action="append")
|
||||
parser.add_option("-l", "--list", dest="list", action="store_true",
|
||||
help="List common attributes (this is not an exhaustive list)")
|
||||
parser.add_option("--usage", action="store_true",
|
||||
help="Program usage")
|
||||
|
||||
@ -62,7 +65,7 @@ def parse_options():
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
if (not options.add and not options.remove) and (not options.desc and
|
||||
not options.addattr and not options.delattr and not options.setattr):
|
||||
not options.addattr and not options.delattr and not options.setattr and not options.list):
|
||||
usage()
|
||||
|
||||
return options, args
|
||||
@ -89,6 +92,14 @@ def main():
|
||||
group=ipa.group.Group()
|
||||
options, args = parse_options()
|
||||
|
||||
if options.list:
|
||||
client = ipaclient.IPAClient()
|
||||
list = client.get_all_attrs()
|
||||
|
||||
for x in list:
|
||||
print x
|
||||
return 0
|
||||
|
||||
if options.usage:
|
||||
usage()
|
||||
if (options.add or options.remove) and (len(args) != 3):
|
||||
|
@ -32,6 +32,7 @@ import ldap
|
||||
import errno
|
||||
|
||||
def usage():
|
||||
print "ipa-moduser [--list]"
|
||||
print "ipa-moduser [-a|--activate] [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] user"
|
||||
sys.exit(1)
|
||||
|
||||
@ -60,6 +61,8 @@ def parse_options():
|
||||
parser.add_option("--setattr", dest="setattr",
|
||||
help="Set an attribute, dropping any existing values that may exist",
|
||||
action="append")
|
||||
parser.add_option("--list", dest="list", action="store_true",
|
||||
help="List common attributes (this is not an exhaustive list)")
|
||||
parser.add_option("-M", "--mailAddress", dest="mail",
|
||||
help="Set user's e-mail address")
|
||||
parser.add_option("--usage", action="store_true",
|
||||
@ -86,6 +89,14 @@ def main():
|
||||
|
||||
options, args = parse_options()
|
||||
|
||||
if options.list:
|
||||
client = ipaclient.IPAClient()
|
||||
list = client.get_all_attrs()
|
||||
|
||||
for x in list:
|
||||
print x
|
||||
return 0
|
||||
|
||||
if options.usage or len(args) != 2:
|
||||
usage()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user