summaryrefslogtreecommitdiffstats
path: root/ipa-admintools
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-10-02 16:56:51 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-10-02 16:56:51 -0400
commit6aa72b44e42ac02487d5dcd08a67940e10dd1ac6 (patch)
tree4f0421e3a761e0d7eb77db32260990394a0b6aa0 /ipa-admintools
parentcfac4acf9fb152d685e342bd5adabb5ec2fa2c74 (diff)
downloadfreeipa.git-6aa72b44e42ac02487d5dcd08a67940e10dd1ac6.tar.gz
freeipa.git-6aa72b44e42ac02487d5dcd08a67940e10dd1ac6.tar.xz
freeipa.git-6aa72b44e42ac02487d5dcd08a67940e10dd1ac6.zip
Do group operations based on the group DN, not the CN
Add new class of errors for connections Raise an exception if a connection cannot be made due to missing ccache
Diffstat (limited to 'ipa-admintools')
-rw-r--r--ipa-admintools/ipa-findgroup2
-rw-r--r--ipa-admintools/ipa-groupmod25
2 files changed, 20 insertions, 7 deletions
diff --git a/ipa-admintools/ipa-findgroup b/ipa-admintools/ipa-findgroup
index 082e6e50..7d5a3166 100644
--- a/ipa-admintools/ipa-findgroup
+++ b/ipa-admintools/ipa-findgroup
@@ -28,7 +28,7 @@ import xmlrpclib
import kerberos
def usage():
- print "ipa-findgroup <uid>"
+ print "ipa-findgroup <group_name>"
sys.exit()
def parse_options():
diff --git a/ipa-admintools/ipa-groupmod b/ipa-admintools/ipa-groupmod
index f3de9263..e0e95307 100644
--- a/ipa-admintools/ipa-groupmod
+++ b/ipa-admintools/ipa-groupmod
@@ -54,6 +54,15 @@ def parse_options():
return options, args
+def get_group(client, group_cn):
+ try:
+ group = client.get_group_by_cn(group_cn)
+ except ipa.ipaerror.IPAError, e:
+ print "%s" % e.message
+ return None
+
+ return group
+
def main():
group=ipa.group.Group()
options, args = parse_options()
@@ -66,16 +75,20 @@ def main():
try:
client = ipaclient.IPAClient()
if options.add:
- client.add_user_to_group(args[1], args[2])
+ group = get_group(client, args[2])
+ if group is None:
+ return 1
+ client.add_user_to_group(args[1], group.dn)
print args[1] + " successfully added to " + args[2]
elif options.remove:
- client.remove_user_from_group(args[1], args[2])
+ group = get_group(client, args[2])
+ if group is None:
+ return 1
+ client.remove_user_from_group(args[1], group.dn)
print args[1] + " successfully removed"
elif options.desc:
- try:
- group = client.get_group_by_cn(args[1])
- except ipa.ipaerror.IPAError, e:
- print "%s" % e.message
+ group = get_group(client, args[1])
+ if group is None:
return 1
group.setValue('description', options.desc)
client.update_group(group)