Invite modal returns incorrect results if highest role originates from a group invite
Summary
When inviting a user to a group, the Select a role
options are incorrect when the highest role originates from a group invitation. max_access_level
seems to only return the direct role in the group. However, it can be higher if they are a member of an invited group.
Related to https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/3694
Steps to reproduce
Scenario 1 - Empty list:
- Create two top-level groups
- Group1
- Group2
- Invite another user to
Group2
as anOwner
- Invite
Group2
toGroup1
with anOwner
role - Have the other user Invite a member
- Observe that the role list is empty
Scenario 2 - Lower roles
- Create two top-level groups
- Group1
- Group2
- Invite another user to
Group2
as anOwner
- Invite
Group2
toGroup1
with anOwner
role - Invite the other user with a
Developer
role toGroup1
- Have the other user Invite a member
- Observe that the role list is limited to
Developer
, however, the user is actually anOwner
What is the current bug behavior?
Scenario 1:
No results found
Scenario 2:
- Limited to
Developer
, however, actual role isOwner
What is the expected correct behavior?
Role selection considers group invite max role