summaryrefslogtreecommitdiffstats
path: root/ipa-python/rpcclient.py
diff options
context:
space:
mode:
authorKevin McCarthy <kmccarth@redhat.com>2007-10-09 09:26:16 -0700
committerKevin McCarthy <kmccarth@redhat.com>2007-10-09 09:26:16 -0700
commit2b38769b50b51d28111a07be86d9fc70e5b6b8f5 (patch)
tree0eb02fb25e56a42b11f32ff83cde1f5337ae28ce /ipa-python/rpcclient.py
parentaaa992b74405f41e2f51d1fb2946c57303c3de07 (diff)
downloadfreeipa-2b38769b50b51d28111a07be86d9fc70e5b6b8f5.tar.gz
freeipa-2b38769b50b51d28111a07be86d9fc70e5b6b8f5.tar.xz
freeipa-2b38769b50b51d28111a07be86d9fc70e5b6b8f5.zip
Combine get_user/group by dn/cn into get_entry_by_cn/dn.
Also a couple double-escaping fixes I missed in the last patch.
Diffstat (limited to 'ipa-python/rpcclient.py')
-rw-r--r--ipa-python/rpcclient.py67
1 files changed, 27 insertions, 40 deletions
diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py
index d0b0c227e..8bc288b48 100644
--- a/ipa-python/rpcclient.py
+++ b/ipa-python/rpcclient.py
@@ -66,26 +66,45 @@ class RPCClient:
obj[k] = ent[k]
return obj
-
-# User support
- def get_user_by_uid(self,uid,sattrs=None):
- """Get a specific user. If sattrs is not None then only those
+# General searches
+
+ def get_entry_by_dn(self,dn,sattrs=None):
+ """Get a specific entry. If sattrs is not None then only those
attributes will be returned, otherwise all available
attributes are returned. The result is a dict."""
server = self.setup_server()
if sattrs is None:
sattrs = "__NONE__"
try:
- result = server.get_user_by_uid(uid, sattrs)
+ result = server.get_entry_by_dn(dn, sattrs)
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_user_by_dn(self,dn,sattrs=None):
+
+ def get_entry_by_cn(self,cn,sattrs=None):
+ """Get a specific entry by cn. If sattrs is not None then only those
+ attributes will be returned, otherwise all available
+ attributes are returned. The result is a dict."""
+ server = self.setup_server()
+ if sattrs is None:
+ sattrs = "__NONE__"
+ try:
+ result = server.get_entry_by_cn(cn, sattrs)
+ 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)
+
+
+# User support
+
+ def get_user_by_uid(self,uid,sattrs=None):
"""Get a specific user. If sattrs is not None then only those
attributes will be returned, otherwise all available
attributes are returned. The result is a dict."""
@@ -93,7 +112,7 @@ class RPCClient:
if sattrs is None:
sattrs = "__NONE__"
try:
- result = server.get_user_by_dn(dn, sattrs)
+ result = server.get_user_by_uid(uid, sattrs)
except xmlrpclib.Fault, fault:
raise ipaerror.gen_exception(fault.faultCode, fault.faultString)
except socket.error, (value, msg):
@@ -258,38 +277,6 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
# Group support
-
- def get_group_by_cn(self,cn,sattrs=None):
- """Get a specific group. If sattrs is not None then only those
- attributes will be returned, otherwise all available
- attributes are returned. The result is a dict."""
- server = self.setup_server()
- if sattrs is None:
- sattrs = "__NONE__"
- try:
- result = server.get_group_by_cn(cn, sattrs)
- 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_group_by_dn(self,dn,sattrs=None):
- """Get a specific group. If sattrs is not None then only those
- attributes will be returned, otherwise all available
- attributes are returned. The result is a dict."""
- server = self.setup_server()
- if sattrs is None:
- sattrs = "__NONE__"
- try:
- result = server.get_group_by_dn(dn, sattrs)
- 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_groups_by_member(self,member_dn,sattrs=None):
"""Gets the groups that member_dn belongs to.