summaryrefslogtreecommitdiffstats
path: root/ipa-server/xmlrpc-server/funcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/xmlrpc-server/funcs.py')
-rw-r--r--ipa-server/xmlrpc-server/funcs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index a182d4b26..6f7e4e66b 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -363,6 +363,17 @@ class IPAServer:
return users
+ def convert_scalar_values(self, orig_dict):
+ """LDAP update dicts expect all values to be a list (except for dn).
+ This method converts single entries to a list."""
+ new_dict={}
+ for (k,v) in orig_dict.iteritems():
+ if not isinstance(v, list) and k != 'dn':
+ v = [v]
+ new_dict[k] = v
+
+ return new_dict
+
def update_user (self, args, newuser=None, opts=None):
"""Update a user in LDAP"""
global _LDAPPool
@@ -384,6 +395,9 @@ class IPAServer:
if (isinstance(newuser, tuple)):
newuser = newuser[0]
+ olduser = self.convert_scalar_values(olduser)
+ newuser = self.convert_scalar_values(newuser)
+
# Should be able to get this from either the old or new user
# but just in case someone has decided to try changing it, use the
# original