fix retrieval of group members and cache group members

replaces https://github.com/owncloud/core/pull/11161

This is the missing piece to fix https://github.com/owncloud/core/issues/10513 for LDAP users.

Please review! Please mind, the performance is not very lovely on a big LDAP setup, but i brought it down from over 40 to less than 10s with a huge user base (OpenLDAP). Getting group memberships is the expensive part here. At least it works… Testing with AD is also yet necessary.