def create_con_group(con, udm_group, wait_for_sync): con_group = map_udm_group_to_con(udm_group.group) print("\nCreating CON group {}\n".format(con_group)) groupname = udm_group.group.get("name") con_group_dn = con.group_create(groupname, **con_group) udm_group_dn = ldap.dn.dn2str([ [("cn", to_unicode(groupname), ldap.AVA_STRING)], [("CN", "groups", ldap.AVA_STRING)]] + ldap.dn.str2dn(configRegistry.get('ldap/base'))) wait_for_sync() verify_udm_object("groups/group", udm_group_dn, udm_group.group) return (con_group, con_group_dn, udm_group_dn)
def create_con_user(con, udm_user, wait_for_sync): basic_con_user = map_udm_user_to_con(udm_user.basic) print("\nCreating CON user {}\n".format(basic_con_user)) username = udm_user.basic.get("username") con_user_dn = con.createuser(username, **basic_con_user) udm_user_dn = ldap.dn.dn2str([ [("uid", to_unicode(username), ldap.AVA_STRING)], [("CN", "users", ldap.AVA_STRING)]] + ldap.dn.str2dn(configRegistry.get('ldap/base'))) wait_for_sync() verify_udm_object("users/user", udm_user_dn, udm_user.basic) return (basic_con_user, con_user_dn, udm_user_dn)
def delete_con_group(con, con_group_dn, udm_group_dn, wait_for_sync): print("\nDeleting CON group\n") con.delete(con_group_dn) wait_for_sync() verify_udm_object("groups/group", udm_group_dn, None)
def delete_con_user(con, con_user_dn, udm_user_dn, wait_for_sync): print("\nDeleting CON user\n") con.delete(con_user_dn) wait_for_sync() verify_udm_object("users/user", udm_user_dn, None)