//UserIsInGroup used to check if a given username is a group member of a list of reference group name.
UserIsInGroup used to check if a given username is a group member of a list of reference group name.
// UserIsInGroup used to check if a given username is a group member of a list of reference group name .
func (lc *HelperLDAP) UserIsInGroup(username string, groupname []string) (bool, liberr.Error) {
	var (
		err     liberr.Error
		grpMmbr []string
	)
	if username, err = lc.getUserName(username); err != nil {
		return false, err
	} else if grpMmbr, err = lc.UserMemberOf(username); err != nil {
		return false, err
	}
	for _, grpSrch := range groupname {
		for _, grpItem := range grpMmbr {
			if strings.EqualFold(grpSrch, grpItem) {
				return true, nil
			}
		}
	}
	return false, nil
}
func ( lc * HelperLDAP ) UserIsInGroup ( username string , groupname [ ] string ) ( bool , liberr . Error ) { var ( err liberr . Error grpMmbr [ ] string ) if username , err = lc . getUserName ( username ) ; err != nil { return false , err } else if grpMmbr , err = lc . UserMemberOf ( username ) ; err != nil { return false , err } for _ , grpSrch := range groupname { for _ , grpItem := range grpMmbr { if strings . EqualFold ( grpSrch , grpItem ) { return true , nil } } } return false , nil }
UserIsInGroup used to check if a given username is a group member of a list of reference group name.
UserIsInGroup used to check if a given username is a group member of a list of reference group name .