diff options
Diffstat (limited to 'ipa-python')
-rw-r--r-- | ipa-python/ipaclient.py | 15 | ||||
-rw-r--r-- | ipa-python/rpcclient.py | 30 |
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() |