//UsersOfGroup used to retrieve the member list of a given group name.
UsersOfGroup used to retrieve the member list of a given group name.
// UsersOfGroup used to retrieve the member list of a given group name .
func (lc *HelperLDAP) UsersOfGroup(groupname string) ([]string, liberr.Error) {
	var (
		err liberr.Error
		src *ldap.SearchResult
		grp []string
	)
	grp = make([]string, 0)
	src, err = lc.runSearch(fmt.Sprintf(lc.config.FilterGroup, groupFieldCN, groupname), []string{"member"})
	if err != nil {
		return grp, err
	}
	for _, entry := range src.Entries {
		for _, mmb := range entry.GetAttributeValues("member") {
			member := lc.ParseEntries(mmb)
			grp = append(grp, member["uid"]...)
		}
	}
	lc.getLogEntry(liblog.DebugLevel, "ldap group user list success").FieldAdd("ldap.group", groupname).FieldAdd("ldap.userlist", grp).Log()
	return grp, nil
}
func ( lc * HelperLDAP ) UsersOfGroup ( groupname string ) ( [ ] string , liberr . Error ) { var ( err liberr . Error src * ldap . SearchResult grp [ ] string ) grp = make ( [ ] string , 0 ) src , err = lc . runSearch ( fmt . Sprintf ( lc . config . FilterGroup , groupFieldCN , groupname ) , [ ] string { " " } ) if err != nil { return grp , err } for _ , entry := range src . Entries { for _ , mmb := range entry . GetAttributeValues ( " " ) { member := lc . ParseEntries ( mmb ) grp = append ( grp , member [ " " ] ... ) } } lc . getLogEntry ( liblog . DebugLevel , " " ) . FieldAdd ( " " , groupname ) . FieldAdd ( " " , grp ) . Log ( ) return grp , nil }
UsersOfGroup used to retrieve the member list of a given group name.
UsersOfGroup used to retrieve the member list of a given group name .