user_ldap: Filter groups after nexted groups
user_ldap: Filter groups after nexted groups

Currently groupsMatchFilter is called before nested groups are resolved.
This basicly breaks this feature since it is not possible to inherit
membership in a group from another group.

Minimal example:

  Group filter: (&(objectClass=group),(cn=nextcloud))
  Nested groups: enabled

  cn=nextcloud,ou=Nextcloud,ou=groups,dn=company,dn=local
    objectClass: group

  cn=IT,ou=groups,dn=company,dn=local
    objectClass: group
    memberOf: cn=nextcloud,ou=Nextcloud,ou=groups,dn=company,dn=local

  cn=John Doe,ou=users,dn=company,dn=local
    objectClass: person
    memberOf: cn=IT,ou=groups,dn=company,dn=local

Since 'cn=IT,ou=groups,dn=company,dn=local' doesn't match the group
filter, John wouldn't be a member of group 'nextcloud'.

This patch fixes this by filtering the groups after all nested groups
have been collected. If nested groups is disabled the result will be the
same as without this patch.

Signed-off-by: Roland Tapken <0d270388f2f92757a5de0f4bd891d3b392c44c4f@bitarbeiter.net>

andreas-p/nextcloud-server,andreas-p/nextcloud-server,nextcloud/server,nextcloud/server,andreas-p/nextcloud-server,nextcloud/server,andreas-p/nextcloud-server,nextcloud/server,andreas-p/nextcloud-server