https://fedorahosted.org/freeipa/ticket/5387

Patch attached.
From 57c97dffceb53647ac331697f6a54ff3e483aecf Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 20 Oct 2015 19:40:37 +0200
Subject: [PATCH] baseuser-add: fix post_callback

Contains:
* Manager should be shown as login instead of DN
* Convert_usercertificate_method should be called for stageuser_add too
* add common methods for user and stageuser to post_common_callback

https://fedorahosted.org/freeipa/ticket/5387
---
 ipalib/plugins/baseuser.py  | 4 ++++
 ipalib/plugins/stageuser.py | 4 +---
 ipalib/plugins/user.py      | 4 ----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/ipalib/plugins/baseuser.py b/ipalib/plugins/baseuser.py
index 40114d6e994d0c1f814ce0c5b362c9cf4848f850..da4883ccec906472ed2e82f5c61ef91c9b2049e9 100644
--- a/ipalib/plugins/baseuser.py
+++ b/ipalib/plugins/baseuser.py
@@ -494,6 +494,10 @@ class baseuser_add(LDAPCreate):
     def post_common_callback(self, ldap, dn, entry_attrs, **options):
         assert isinstance(dn, DN)
         self.obj.convert_usercertificate_post(entry_attrs, **options)
+        self.obj.convert_manager(entry_attrs, **options)
+        self.obj.get_password_attributes(ldap, dn, entry_attrs)
+        convert_sshpubkey_post(ldap, dn, entry_attrs)
+        radius_dn2pk(self.api, entry_attrs)
 
 class baseuser_del(LDAPDelete):
     """
diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
index 00fba1f8329e638a304e3f70d10b89aaf38aaebc..47c96bb715fcf8293f4ce257566ab914644fa489 100644
--- a/ipalib/plugins/stageuser.py
+++ b/ipalib/plugins/stageuser.py
@@ -389,9 +389,7 @@ class stageuser_add(baseuser_add):
                 # if both randompassword and userpassword options were used
                 pass
 
-        self.obj.get_password_attributes(ldap, dn, entry_attrs)
-        convert_sshpubkey_post(ldap, dn, entry_attrs)
-        radius_dn2pk(self.api, entry_attrs)
+        self.post_common_callback(ldap, dn, entry_attrs, **options)
         return dn
 
 @register()
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 848836cd15add707f002b032e31c54d520472bb7..94c90632cbacf510c2217b56242e35a10dbd9c57 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -542,7 +542,6 @@ class user_add(baseuser_add):
         except errors.AlreadyGroupMember:
             pass
 
-        self.obj.convert_manager(entry_attrs, **options)
         # delete description attribute NO_UPG_MAGIC if present
         if options.get('noprivate', False):
             if not options.get('all', False):
@@ -568,9 +567,6 @@ class user_add(baseuser_add):
                 # if both randompassword and userpassword options were used
                 pass
 
-        self.obj.get_password_attributes(ldap, dn, entry_attrs)
-        convert_sshpubkey_post(ldap, dn, entry_attrs)
-        radius_dn2pk(self.api, entry_attrs)
         self.obj.get_preserved_attribute(entry_attrs, options)
 
         self.post_common_callback(ldap, dn, entry_attrs, **options)
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to