API v4 does not return all the groups a user belong to

Summary

It is not possible to get the groups a user belong to with the API

Steps to reproduce

  • User Bob creates a Group A
  • User Bob creates a subGroup AB
  • User Bob creates a sub-subgroup AB1
  • User Bob creates a sub-subgroup AB2
  • User Bob adds user Alicie to Group A with reporter permission
  • User Alice query the API to get all the groups she belong to and just gets Group A:

curl --header "PRIVATE-TOKEN: ****" -XGET https://gitlab.com/api/v4/groups

Example Project

We are having this error with the meta group https://gitlab.com/Bitergia and I've created and example at:

The user gitlab2phabricator-bot sees all these groups through the web interface, but can't get them using the API.

What is the current bug behavior?

API request GET /groups does not return all the groups a user belong to

What is the expected correct behavior?

API request GET /groups returns all the groups a user belong to (the ones that are accessible using the web interface)

Relevant logs and/or screenshots

No relevant logs

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

None

Results of GitLab application Check

None

Possible fixes

None