summaryrefslogtreecommitdiffstats
path: root/ipa-python/rpcclient.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-python/rpcclient.py')
-rw-r--r--ipa-python/rpcclient.py145
1 files changed, 134 insertions, 11 deletions
diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py
index ed23015e1..6f039f9fa 100644
--- a/ipa-python/rpcclient.py
+++ b/ipa-python/rpcclient.py
@@ -218,23 +218,32 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
- def get_add_schema(self):
- """Get the list of attributes we need to ask when adding a new
- user.
- """
+ def get_custom_fields(self):
+ """Get custom user fields."""
server = self.setup_server()
- # FIXME: Hardcoded and designed for the TurboGears GUI. Do we want
- # this for the CLI as well?
try:
- result = server.get_add_schema()
+ result = server.get_custom_fields()
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 set_custom_fields(self, schema):
+ """Set custom user fields."""
+ server = self.setup_server()
+
+ try:
+ result = server.set_custom_fields(schema)
+ 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 get_all_users (self):
"""Return a list containing a User object for each existing user."""
@@ -309,12 +318,12 @@ class RPCClient:
return result
- def mark_user_deleted(self,uid):
- """Mark a user as deleted/inactive"""
+ def mark_user_active(self,uid):
+ """Mark a user as active"""
server = self.setup_server()
try:
- result = server.mark_user_deleted(uid)
+ result = server.mark_user_active(uid)
except xmlrpclib.Fault, fault:
raise ipaerror.gen_exception(fault.faultCode, fault.faultString)
except socket.error, (value, msg):
@@ -322,6 +331,20 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
+ def mark_user_inactive(self,uid):
+ """Mark a user as inactive"""
+ server = self.setup_server()
+
+ try:
+ result = server.mark_user_inactive(uid)
+ 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)
+
+
# Group support
def get_groups_by_member(self,member_dn,sattrs=None):
@@ -592,6 +615,106 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
+ def mark_group_active(self,cn):
+ """Mark a group as active"""
+ server = self.setup_server()
+
+ try:
+ result = server.mark_group_active(cn)
+ 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 mark_group_inactive(self,cn):
+ """Mark a group as inactive"""
+ server = self.setup_server()
+
+ try:
+ result = server.mark_group_inactive(cn)
+ 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)
+
+# Configuration support
+
+ def get_ipa_config(self):
+ """Get the IPA configuration"""
+ server = self.setup_server()
+ try:
+ result = server.get_ipa_config()
+ 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_ipa_config(self, oldconfig, newconfig):
+ """Update the IPA configuration"""
+ server = self.setup_server()
+ try:
+ result = server.update_ipa_config(oldconfig, newconfig)
+ 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 get_password_policy(self):
+ """Get the IPA password policy"""
+ server = self.setup_server()
+ try:
+ result = server.get_password_policy()
+ 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_password_policy(self, oldpolicy, newpolicy):
+ """Update the IPA password policy"""
+ server = self.setup_server()
+ try:
+ result = server.update_password_policy(oldpolicy, newpolicy)
+ 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 add_service_principal(self, princ_name):
+ server = self.setup_server()
+
+ try:
+ result = server.add_service_principal(princ_name)
+ 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 get_keytab(self, princ_name):
+ server = self.setup_server()
+
+ try:
+ result = server.get_keytab(princ_name)
+ 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)
+
# radius support
def get_radius_client_by_ip_addr(self, ip_addr, container, sattrs=None):