fix retrieval of group members and cache group members

Needed LDAP adjustement for #9225 (to fix #10513), also requires #10526.