summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-08-23 11:57:25 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-08-23 11:57:25 -0400
commit240a99b6f35fe7a7de37c83e69471b84298d0f56 (patch)
tree73f91f4c6e829ecdfe320413d2ad5d817cabf185
parent8879ee173ec6814da701464c562471a3c8c5d846 (diff)
downloadfreeipa-240a99b6f35fe7a7de37c83e69471b84298d0f56.tar.gz
freeipa-240a99b6f35fe7a7de37c83e69471b84298d0f56.tar.xz
freeipa-240a99b6f35fe7a7de37c83e69471b84298d0f56.zip
Move add user logic to the server side
-rw-r--r--ipa-python/ipaclient.py18
-rw-r--r--ipa-server/xmlrpc-server/funcs.py28
2 files changed, 29 insertions, 17 deletions
diff --git a/ipa-python/ipaclient.py b/ipa-python/ipaclient.py
index d7450f5ca..dc8e1dc9b 100644
--- a/ipa-python/ipaclient.py
+++ b/ipa-python/ipaclient.py
@@ -71,25 +71,9 @@ class IPAClient:
realm = config.config.get_realm()
- # FIXME: This should be dynamic and can include just about anything
- # Let us add in some missing attributes
- if user.getValue('homedirectory') is None:
- user.setValue('homedirectory', '/home/%s' % user.getValue('uid'))
- if user.getValue('gecos') is None:
- user.setValue('gecos', user.getValue('uid'))
-
- # FIXME: This can be removed once the DS plugin is installed
- user.setValue('uidnumber', '501')
-
- # FIXME: What is the default group for users?
- user.setValue('gidnumber', '501')
- user.setValue('krbprincipalname', "%s@%s" % (user.getValue('uid'), realm))
- user.setValue('cn', "%s %s" % (user.getValue('givenname'),
- user.getValue('sn')))
user_dict = user.toDict()
- if user_dict.get('gn'):
- del user_dict['gn']
+ # dn is set on the server-side
del user_dict['dn']
# convert to a regular dict before sending
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index 0af0f5ef4..aa5633453 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -172,6 +172,34 @@ class IPAServer:
dn="uid=%s,%s,%s" % (user['uid'], user_container,self.basedn)
entry = ipaserver.ipaldap.Entry(dn)
+ # FIXME: This should be dynamic and can include just about anything
+
+ # Let us add in some missing attributes
+ if user.get('homedirectory') is None:
+ user['homedirectory'] = '/home/%s' % user.get('uid')
+ if not user.get('gecos') is None:
+ user['gecos'] = user['uid']
+
+ # FIXME: This can be removed once the DS plugin is installed
+ user['uidnumber'] = '501'
+
+ # FIXME: What is the default group for users?
+ user['gidnumber'] = '501'
+
+ realm = ipa.config.config.get_realm()
+ user['krbprincipalname'] = "%s@%s" % (user.get('uid'), realm)
+
+ # FIXME. This is a hack so we can request separate First and Last
+ # name in the GUI.
+ if user.get('cn') is None:
+ user['cn'] = "%s %s" % (user.get('givenname'),
+ user.get('sn'))
+
+ if user.get('gn'):
+ del user['gn']
+ if user.get('givenname'):
+ del user['givenname']
+
# some required objectclasses
entry.setValues('objectClass', 'top', 'posixAccount', 'shadowAccount', 'account', 'person', 'inetOrgPerson', 'organizationalPerson', 'krbPrincipalAux', 'krbTicketPolicyAux')