summaryrefslogtreecommitdiffstats
path: root/ipa-admintools
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-02-28 11:34:34 -0500
committerRob Crittenden <rcritten@redhat.com>2008-02-28 11:34:34 -0500
commit6b960c008a58bd004e95b2726806801a90bcbaf0 (patch)
tree1b1414eec2f82c3446a147e89e64df6eb4cb5f06 /ipa-admintools
parentd7ad62cd7e1d861270e8fd0ff8a2dd7ddba90127 (diff)
downloadfreeipa-6b960c008a58bd004e95b2726806801a90bcbaf0.tar.gz
freeipa-6b960c008a58bd004e95b2726806801a90bcbaf0.tar.xz
freeipa-6b960c008a58bd004e95b2726806801a90bcbaf0.zip
Allow groups to be added as a group membe
435134
Diffstat (limited to 'ipa-admintools')
-rw-r--r--ipa-admintools/ipa-modgroup35
-rw-r--r--ipa-admintools/man/ipa-modgroup.111
2 files changed, 39 insertions, 7 deletions
diff --git a/ipa-admintools/ipa-modgroup b/ipa-admintools/ipa-modgroup
index ffbd2d865..b40df4be9 100644
--- a/ipa-admintools/ipa-modgroup
+++ b/ipa-admintools/ipa-modgroup
@@ -21,6 +21,7 @@
def usage():
print "ipa-modgroup [-l|--list]"
print "ipa-modgroup [-a|--add] [-r|--remove] user group"
+ print "ipa-modgroup [-g|--groupadd] [-e|--groupdel] group group"
print "ipa-modgroup [-d|--desc description STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] group"
sys.exit(1)
@@ -33,6 +34,10 @@ def parse_options():
help="Add a user to the group")
parser.add_option("-r", "--remove", dest="remove", action="store_true",
help="Remove a user from the group")
+ parser.add_option("-g", "--groupadd", dest="groupadd", action="store_true",
+ help="Add a group to the group")
+ parser.add_option("-e", "--groupdel", dest="groupdel", action="store_true",
+ help="Remove a group from the group")
parser.add_option("-d", "--description", dest="desc",
help="Modify the description of the group")
parser.add_option("--addattr", dest="addattr",
@@ -51,8 +56,10 @@ def parse_options():
args = ipa.config.init_config(sys.argv)
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 and not options.list):
+ if ((not options.add and not options.remove) and
+ (not options.groupadd and not options.groupdel) and
+ (not options.desc and not options.addattr and
+ not options.delattr and not options.setattr and not options.list)):
usage()
return options, args
@@ -111,6 +118,30 @@ def main():
for user in users:
client.remove_user_from_group(user, group.dn)
print user + " successfully removed"
+ elif options.groupadd:
+ group = get_group(client, options, args[2])
+ if group is None:
+ return 1
+ groups = args[1].split(',')
+ for g in groups:
+ tgroup = get_group(client, options, g)
+ if tgroup is not None:
+ client.add_group_to_group(tgroup.dn, group.dn)
+ print g + " successfully added to " + args[2]
+ else:
+ print "Group %s not found" % g
+ elif options.groupdel:
+ group = get_group(client, options, args[2])
+ if group is None:
+ return 1
+ groups = args[1].split(',')
+ for g in groups:
+ tgroup = get_group(client, options, g)
+ if tgroup is not None:
+ client.remove_member_from_group(tgroup.dn, group.dn)
+ print g + " successfully removed " + args[2]
+ else:
+ print "Group %s not found" % g
else:
group = get_group(client, options, args[1])
if group is None:
diff --git a/ipa-admintools/man/ipa-modgroup.1 b/ipa-admintools/man/ipa-modgroup.1
index 193d4a7c4..6a517a749 100644
--- a/ipa-admintools/man/ipa-modgroup.1
+++ b/ipa-admintools/man/ipa-modgroup.1
@@ -28,23 +28,24 @@ Updates the members or description of \fIgroup\fR.
.TP
\fB\-a\fR, \fB\-\-add\fR=\fIuser1,user2,...usern\fR
Add one or more users to the group
-
.TP
\fB\-d\fR, \fB\-\-description\fR=\fIdescription\fR
Modify the description of the group
-
+.TP
+\fB\-e\fR, \fB\-\-groupdel\fR=\fIgroup1,group2,...groupn\fR
+Remove one or more groups from the group
+.TP
+\fB\-g\fR, \fB\-\-groupadd\fR=\fIgroup1,group2,...groupn\fR
+Add one or more groups to the group
.TP
\fB\-r\fR, \fB\-\-remove\fR=\fIuser1,user2,...usern\fR
Remove one or more users from the group
-
.TP
\fB\-\-addattr\fR \fIattr=value\fR
Add a new attribute, or value to an existing attribute
-
.TP
\fB\-\-delattr\fR \fIattr=value\fR
Remove an attribute and all values
-
.TP
\fB\-\-setattr\fR \fIattr=value\fR
Set an attribute to a new value, removing all old ones