Inherited group members are missing in `shared_with_groups` when using Projects API
Summary
The Get single project Projects API endpoint supposedly returns the shared_with_groups which should list down the groups where the group was shared (i.e. which groups have access to the group). At the moment it looks like the API will only show direct members which is different from what the UI is showing.
Steps to reproduce
- Create a top level group
TopLevel. - Create another top level group
DirectGroup. - Create another top level group
InheritedGroup. - Invite
InheritedGrouptoTopLevel - Create a project under group
TopLevelnamedtest-project. - Invite
DirectGrouptotest-project. - Go to
Project Information > Members > Groupsand see thatInheritedGroupandDirectGroupare listed. - Query the project using the Projects API and see the
InheritedGroupis not listed.
Example Project
What is the current bug behavior?
- Inherited Group members are not included in the API response.
What is the expected correct behavior?
- Inherited Group members should be included in the API response.
Relevant logs and/or screenshots
$ curl --header "PRIVATE-TOKEN: <REDACTED>" "https://gitlab.example.com/api/v4/projects/115" | jq '.shared_with_groups'
...
[
{
"group_id": 110,
"group_name": "test-public-group",
"group_full_path": "test-public-group",
"group_access_level": 10,
"expires_at": null
}
]
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Edited by Christina Lohr
