summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipa_server/plugins/b_ldap.py7
-rw-r--r--ipalib/plugins/f_user.py42
2 files changed, 29 insertions, 20 deletions
diff --git a/ipa_server/plugins/b_ldap.py b/ipa_server/plugins/b_ldap.py
index 6383bb0b5..69c2aeb58 100644
--- a/ipa_server/plugins/b_ldap.py
+++ b/ipa_server/plugins/b_ldap.py
@@ -25,10 +25,10 @@ This wraps the python-ldap bindings.
import ldap as _ldap
from ipalib import api
-from ipalib.backend import Backend
+from ipalib.crud import CrudBackend
-class ldap(Backend):
+class ldap(CrudBackend):
"""
LDAP backend plugin.
"""
@@ -45,4 +45,7 @@ class ldap(Backend):
self.api.env.basedn,
)
+ def create(self, **kw):
+ return kw
+
api.register(ldap)
diff --git a/ipalib/plugins/f_user.py b/ipalib/plugins/f_user.py
index 571f6fa8d..b35a11223 100644
--- a/ipalib/plugins/f_user.py
+++ b/ipalib/plugins/f_user.py
@@ -55,20 +55,36 @@ class user(frontend.Object):
User object.
"""
takes_params = (
- Param('givenname', cli_name='firstname'),
- Param('sn', cli_name='lastname'),
+ Param('givenname',
+ cli_name='first',
+ doc='User first name',
+ ),
+ Param('sn',
+ cli_name='last',
+ doc='User last name',
+ ),
Param('uid',
cli_name='user',
primary_key=True,
default_from=lambda givenname, sn: givenname[0] + sn,
normalize=lambda value: value.lower(),
),
- Param('krbprincipalname',
- default_from=lambda uid: '%s@EXAMPLE.COM' % uid,
+ Param('gecos',
+ doc='GECOS field',
+ default_from=lambda uid: uid,
),
Param('homedirectory',
+ cli_name='home',
+ doc='Path of user home directory',
default_from=lambda uid: '/home/%s' % uid,
- )
+ ),
+ Param('shell',
+ default=u'/bin/sh',
+ doc='Login shell',
+ ),
+ Param('krbprincipalname?', cli_name='principal',
+ default_from=lambda uid: '%s@EXAMPLE.COM' % uid,
+ ),
)
api.register(user)
@@ -90,21 +106,11 @@ class user_add(crud.Add):
"""
assert 'uid' not in kw
assert 'dn' not in kw
+ ldap = self.api.Backend.ldap
kw['uid'] = uid
- kw['dn'] = self.api.Backend.ldap.get_user_dn(uid)
-
- return kw
-
- # FIXME: ug, really?
- if not kw.get('container'):
- user_container = servercore.DefaultUserContainer
- else:
- user_container = kw['container']
- del kw['container']
-
- user = kw
+ kw['dn'] = ldap.get_user_dn(uid)
+ return ldap.create(**kw)
- user['uid'] = args[0]
if servercore.user_exists(user['uid']):
raise errors.Duplicate("user already exists")