[For Gitlab.com / Non administrator plans] API endpoint to get all membership (projects and groups) of a given user, on the projects/groups owned by the user making the API call.
Following #20532 (closed), purpose of this issue is to provide an API endpoint like:
/users/:id-or-username/membership which works with gitlab.com / free account (without administrator).
It will return all the groups and projects owned by the user making the API call where the :id-or-username is member. It would be nice to be able to filter by namespace begining with some string so we can exclude "outside" project the user is member too.
Some code already exists and could be used to implement this faster, as when connected as a gitlab user those web pages https://gitlab.com/users/j.doe/groups and https://gitlab.com/users/j.doe/contributed return exactly those information: project/group the gitlab user own where j.doe is member. Actually we cannot get those information with API.
Use case: very well resumed here : #20532 (comment 215099642) Use case 1: Functional Requirement: We need to be able to query GitLab to get a list of groups and projects that a user is in (direct list, not inherited). Description: When a user leaves the company, we need to remove their project and group access. This is for two reasons: 1. cleanup the system, 2. If the user comes back in a different role, they shouldn't have access to their previous groups and projects by default
Actually the only way is to get list of all projects, and search for user into it... which need many API calls, and so not performant and ressources wasting for the client and for gitlab.