summaryrefslogtreecommitdiffstats
path: root/ipa-server
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server')
-rw-r--r--ipa-server/ipaserver/ipaldap.py2
-rw-r--r--ipa-server/xmlrpc-server/funcs.py19
2 files changed, 19 insertions, 2 deletions
diff --git a/ipa-server/ipaserver/ipaldap.py b/ipa-server/ipaserver/ipaldap.py
index 936dd662..a0f1cab4 100644
--- a/ipa-server/ipaserver/ipaldap.py
+++ b/ipa-server/ipaserver/ipaldap.py
@@ -63,7 +63,7 @@ class Entry:
if isinstance(entrydata,tuple):
self.dn = entrydata[0]
self.data = ldap.cidict.cidict(entrydata[1])
- elif isinstance(entrydata,str):
+ elif isinstance(entrydata,str) or isinstance(entrydata,unicode):
self.dn = entrydata
self.data = ldap.cidict.cidict()
else:
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index df8bceaa..22f52dae 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -171,14 +171,31 @@ class IPAServer:
return self.convert_entry(ent)
- def add_user (self, user, user_container="ou=users,ou=default",opts=None):
+ def add_user (self, args, user_container="ou=users,ou=default",opts=None):
"""Add a user in LDAP. Takes as input a dict where the key is the
attribute name and the value is either a string or in the case
of a multi-valued field a list of values. user_container sets
where in the tree the user is placed."""
global _LDAPPool
+
+ # The XML-RPC server marshals the arguments into one variable
+ # while the direct caller has them separate. So do a little
+ # bit of gymnastics to figure things out. There has to be a
+ # better way, so FIXME
+ if isinstance(args,tuple):
+ opts = user_container
+ if len(args) == 2:
+ user = args[0]
+ user_container = args[1]
+ else:
+ user = args
+ user_container = "ou=users,ou=default"
+ else:
+ user = args
+
if (isinstance(user, tuple)):
user = user[0]
+
dn="uid=%s,%s,%s" % (user['uid'], user_container,self.basedn)
entry = ipaserver.ipaldap.Entry(str(dn))