Override ancestor group membership does not work for custom role in subgroup
Summary
When a user is invited with guest role at top-level group, it will not allow overriding the inherited membership in the subgroup with a custom guest role as the role will revert to the inherited guest role.
Steps to reproduce
- Invite member at top-level group with guest role
- Invite member at subgroup level with custom guest role as per https://docs.gitlab.com/ee/user/group/subgroups/index.html#override-ancestor-group-membership
- See that the override doesn't take and the member reverts to inherited guest role (not editable)
- Try to override with reporter role - this works and member now has editable reporter role in subgroup
- Try override with custom guest role again, but it reverts back to guest from inherited role at top-level group
- Go to top-level group/subgroup/project and invite user with custom guest role to override
- See that the override is successful with editable custom guest role on project level
Example Project
You can use my test subgroup to see: https://gitlab.com/groups/doniquesmit_ultimate_group/custom-role-subgroup/-/group_members
What is the current bug behavior?
The inherited membership is not being successfully overridden when trying to override with a custom role.
What is the expected correct behavior?
Inviting a member with a custom role in the subgroup should override their inherited role as described in https://docs.gitlab.com/ee/user/group/subgroups/index.html#override-ancestor-group-membership.