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

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Martin Basti
2015-11-05 17:06:22 +01:00
parent 2d041daf17
commit c56d45bc38
3 changed files with 4 additions and 6 deletions

View File

@@ -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):
"""

View File

@@ -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()

View File

@@ -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)