On 21.10.2015 11:14, Martin Basti wrote:
https://fedorahosted.org/freeipa/ticket/5387

Patch attached.



Fix for this ticket has been implemented in patch mbasti-0331-2

Attached patch contains only common postcallback code to from user and stageuser to parent class.
From 4a5b52301199170a194d477648350c7206357415 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Thu, 5 Nov 2015 17:06:22 +0100
Subject: [PATCH] Move common code of user and stageuser to baseuser
 postcallback

usser-add and stageuser-add contains common code that can be exported to
baseuser common postcallback
---
 ipalib/plugins/baseuser.py  | 3 +++
 ipalib/plugins/stageuser.py | 4 +---
 ipalib/plugins/user.py      | 3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ipalib/plugins/baseuser.py b/ipalib/plugins/baseuser.py
index b974e3fb18659e7eb6e75557e0d4db3ec1197dcd..cf0fd88d9b9ee83ee046852e0e4709362947b291 100644
--- a/ipalib/plugins/baseuser.py
+++ b/ipalib/plugins/baseuser.py
@@ -491,6 +491,9 @@ 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.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 5c3e78b138acb89eb66a6f724019b0c1041b76ce..81a7070359253262f30e65298c42759cd055e67d 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -568,9 +568,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