summaryrefslogtreecommitdiffstats
path: root/ipa-python
diff options
context:
space:
mode:
authorKevin McCarthy <kmccarth@redhat.com>2007-09-28 16:01:42 -0700
committerKevin McCarthy <kmccarth@redhat.com>2007-09-28 16:01:42 -0700
commitdbf8c1aeb98c730b7f4a83bfc15062040e331083 (patch)
tree4b1b422e9993d103bffb8764a5b6bc04388f7296 /ipa-python
parent0cfccd0f8cf77fd2a4197cb47becea85173ca48a (diff)
downloadfreeipa-dbf8c1aeb98c730b7f4a83bfc15062040e331083.tar.gz
freeipa-dbf8c1aeb98c730b7f4a83bfc15062040e331083.tar.xz
freeipa-dbf8c1aeb98c730b7f4a83bfc15062040e331083.zip
Add group management to the user edit page.
Added a couple more API calls to make the inverse operations easier.
Diffstat (limited to 'ipa-python')
-rw-r--r--ipa-python/ipaclient.py15
-rw-r--r--ipa-python/rpcclient.py30
2 files changed, 45 insertions, 0 deletions
diff --git a/ipa-python/ipaclient.py b/ipa-python/ipaclient.py
index d047f7717..27ad1c246 100644
--- a/ipa-python/ipaclient.py
+++ b/ipa-python/ipaclient.py
@@ -266,6 +266,21 @@ class IPAClient:
return self.transport.remove_users_from_group(user_uids, group_cn)
+ def add_groups_to_user(self, group_dns, user_dn):
+ """Given a list of group dn's add them to the user.
+
+ Returns a list of the group dns that were not added.
+ """
+ return self.transport.add_groups_to_user(group_dns, user_dn)
+
+ def remove_groups_from_user(self, group_dns, user_dn):
+ """Given a list of group dn's remove them from the user.
+
+ Returns a list of the group dns that were not removed.
+ """
+
+ return self.transport.remove_groups_from_user(group_dns, user_dn)
+
def update_group(self,group):
"""Update a group entry."""
diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py
index cfeb3d20c..9f02b374f 100644
--- a/ipa-python/rpcclient.py
+++ b/ipa-python/rpcclient.py
@@ -441,6 +441,36 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
+ def add_groups_to_user(self, group_dns, user_dn):
+ """Given a list of group dn's add them to the user.
+
+ Returns a list of the group dns that were not added.
+ """
+ server = self.setup_server()
+ try:
+ result = server.add_groups_to_user(group_dns, user_dn)
+ except xmlrpclib.Fault, fault:
+ raise ipaerror.gen_exception(fault.faultCode, fault.faultString)
+ except socket.error, (value, msg):
+ raise xmlrpclib.Fault(value, msg)
+
+ return ipautil.unwrap_binary_data(result)
+
+ def remove_groups_from_user(self, group_dns, user_dn):
+ """Given a list of group dn's remove them from the user.
+
+ Returns a list of the group dns that were not removed.
+ """
+ server = self.setup_server()
+ try:
+ result = server.remove_groups_from_user(group_dns, user_dn)
+ except xmlrpclib.Fault, fault:
+ raise ipaerror.gen_exception(fault.faultCode, fault.faultString)
+ except socket.error, (value, msg):
+ raise xmlrpclib.Fault(value, msg)
+
+ return ipautil.unwrap_binary_data(result)
+
def update_group(self,oldgroup,newgroup):
"""Update an existing group. oldgroup and newgroup are dicts of attributes"""
server = self.setup_server()