summaryrefslogtreecommitdiffstats
path: root/ipa-server/xmlrpc-server/funcs.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2007-10-30 15:07:02 -0400
committerRob Crittenden <rcritten@redhat.com>2007-10-30 15:07:02 -0400
commit1d6e88565c48ee0799ac1df58d4a56444388f0c8 (patch)
tree1b8dfc91d7688a3968e499072c6e7ad80464fddd /ipa-server/xmlrpc-server/funcs.py
parent402274af4bfbefda55d1968bed61b563f8af8559 (diff)
downloadfreeipa-1d6e88565c48ee0799ac1df58d4a56444388f0c8.tar.gz
freeipa-1d6e88565c48ee0799ac1df58d4a56444388f0c8.tar.xz
freeipa-1d6e88565c48ee0799ac1df58d4a56444388f0c8.zip
Add memberOf API call to the XML-RPC interface
Make find-groups use memberOf to have a prettier dispaly of members
Diffstat (limited to 'ipa-server/xmlrpc-server/funcs.py')
-rw-r--r--ipa-server/xmlrpc-server/funcs.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index 257e84d2e..9f8780048 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -1061,6 +1061,37 @@ class IPAServer:
return label_list
+ def memberOf(self, groupdn, attr_list, opts=None):
+ """Do a memberOf search of groupdn and return the attributes in
+ attr_list (an empty list returns everything)."""
+
+ # TODO - retrieve from config
+ timelimit = 2
+
+ searchlimit = 0
+
+ groupdn = self.__safe_filter(groupdn)
+ filter = "(memberOf=%s)" % groupdn
+
+ conn = self.getConnection(opts)
+ try:
+ results = conn.getListAsync(self.basedn, self.scope,
+ filter, attr_list, 0, None, None, timelimit,
+ searchlimit)
+ except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
+ results = [0]
+ finally:
+ self.releaseConnection(conn)
+
+ counter = results[0]
+ results = results[1:]
+
+ entries = [counter]
+ for e in results:
+ entries.append(self.convert_entry(e))
+
+ return entries
+
def ldap_search_escape(match):
"""Escapes out nasty characters from the ldap search.
See RFC 2254."""