summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/f_user.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-14 01:45:30 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-14 01:45:30 -0600
commit1480224724864cb7cf34c9be755b905c61f885b9 (patch)
tree6a5a5deede0e721d8484fe770d62ee53029097d0 /ipalib/plugins/f_user.py
parent20fa90cfb6e954040de47551762dfbb7680dba51 (diff)
downloadfreeipa-1480224724864cb7cf34c9be755b905c61f885b9.tar.gz
freeipa-1480224724864cb7cf34c9be755b905c61f885b9.tar.xz
freeipa-1480224724864cb7cf34c9be755b905c61f885b9.zip
Started roughing out user_add() using api.Backend.ldap; added Command.output_for_cli() to take care of formatting print output
Diffstat (limited to 'ipalib/plugins/f_user.py')
-rw-r--r--ipalib/plugins/f_user.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/ipalib/plugins/f_user.py b/ipalib/plugins/f_user.py
index 22fb8a27..571f6fa8 100644
--- a/ipalib/plugins/f_user.py
+++ b/ipalib/plugins/f_user.py
@@ -75,12 +75,26 @@ api.register(user)
class user_add(crud.Add):
'Add a new user.'
- def execute(self, *args, **kw):
- """args[0] = uid of the user to add
- kw{container} is the location in the DIT to add the user, not
- required
- kw otherwise contains all the attributes
+
+ def execute(self, uid, **kw):
+ """
+ Execute the user-add operation.
+
+ The dn should not be passed as a keyword argument as it is constructed
+ by this method.
+
+ Returns the entry as it will be created in LDAP.
+
+ :param uid: The login name of the user being added.
+ :param kw: Keyword arguments for the other LDAP attributes.
"""
+ assert 'uid' not in kw
+ assert 'dn' not in kw
+ 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
@@ -162,10 +176,6 @@ class user_add(crud.Add):
result = servercore.add_entry(entry)
return result
- def forward(self, *args, **kw):
- result = super(crud.Add, self).forward(*args, **kw)
- if result:
- print "User %s added" % args[0]
api.register(user_add)