func (u *UserInfoLDAPSource) AddmemberstoExisting(groupinfo userinfo.GroupInfo) error {
	conn, err := u.getTargetLDAPConnection()
	if err != nil {
		log.Println(err)
		return err
	}
	defer conn.Close()
	entry, err := u.getGroupDN(conn, groupinfo.Groupname)
	if err != nil {
		log.Println(err)
		return err
	}
	if len(groupinfo.Member) == 0 {
		for _, memberUid := range groupinfo.MemberUid {
			userDN, err := u.getUserDN(conn, memberUid)
			if err != nil {
				return err
			}
			groupinfo.Member = append(groupinfo.Member, userDN)
		}
	}
	modify := ldap.NewModifyRequest(entry)
	modify.Add("member", groupinfo.Member)
	modify.Add("memberUid", groupinfo.MemberUid)
	err = conn.Modify(modify)
	if err != nil {
		log.Println(err)
		return err
	}
	return nil
}
//adding members to existing group
adding members to existing group
// adding members to existing group
func (u *UserInfoLDAPSource) AddmemberstoExisting(groupinfo userinfo.GroupInfo) error {
	conn, err := u.getTargetLDAPConnection()
	if err != nil {
		log.Println(err)
		return err
	}
	defer conn.Close()
	entry, err := u.getGroupDN(conn, groupinfo.Groupname)
	if err != nil {
		log.Println(err)
		return err
	}
	if len(groupinfo.Member) == 0 {
		for _, memberUid := range groupinfo.MemberUid {
			userDN, err := u.getUserDN(conn, memberUid)
			if err != nil {
				return err
			}
			groupinfo.Member = append(groupinfo.Member, userDN)
		}
	}
	modify := ldap.NewModifyRequest(entry)
	modify.Add("member", groupinfo.Member)
	modify.Add("memberUid", groupinfo.MemberUid)
	err = conn.Modify(modify)
	if err != nil {
		log.Println(err)
		return err
	}
	return nil
}
func ( u * UserInfoLDAPSource ) AddmemberstoExisting ( groupinfo userinfo . GroupInfo ) error { conn , err := u . getTargetLDAPConnection ( ) if err != nil { log . Println ( err ) return err } defer conn . Close ( ) entry , err := u . getGroupDN ( conn , groupinfo . Groupname ) if err != nil { log . Println ( err ) return err } if len ( groupinfo . Member ) == 0 { for _ , memberUid := range groupinfo . MemberUid { userDN , err := u . getUserDN ( conn , memberUid ) if err != nil { return err } groupinfo . Member = append ( groupinfo . Member , userDN ) } } modify := ldap . NewModifyRequest ( entry ) modify . Add ( " " , groupinfo . Member ) modify . Add ( " " , groupinfo . MemberUid ) err = conn . Modify ( modify ) if err != nil { log . Println ( err ) return err } return nil }
adding members to existing group
adding members to existing group