func (u *UserInfoLDAPSource) DeletemembersfromGroup(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
	}
	modify := ldap.NewModifyRequest(entry)
	modify.Delete("memberUid", groupinfo.MemberUid)

	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.Delete("member", groupinfo.Member)
	err = conn.Modify(modify)
	if err != nil {
		log.Println(err)
		return err
	}
	return nil
}
//remove members from existing group
remove members from existing group
// remove members from existing group
func (u *UserInfoLDAPSource) DeletemembersfromGroup(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
	}
	modify := ldap.NewModifyRequest(entry)
	modify.Delete("memberUid", groupinfo.MemberUid)
	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.Delete("member", groupinfo.Member)
	err = conn.Modify(modify)
	if err != nil {
		log.Println(err)
		return err
	}
	return nil
}
func ( u * UserInfoLDAPSource ) DeletemembersfromGroup ( 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 } modify := ldap . NewModifyRequest ( entry ) modify . Delete ( " " , groupinfo . MemberUid ) 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 . Delete ( " " , groupinfo . Member ) err = conn . Modify ( modify ) if err != nil { log . Println ( err ) return err } return nil }
remove members from existing group
remove members from existing group