Pending group access request determines which roles can be given in subgroup
Summary
When there is a pending access request for user X in group A, the available roles that can be given to user X in a subgroup B of group A are limited to anything that is equal or higher than the Max role of the pending access request. In other words: If a user requests membership to a group, they then cannot be given a role lower than Developer (the default Max role for group membership requests) for direct membership in any subgroup.
Steps to reproduce
- Create group A
- Create subgroup B
- Request membership to group A with a different account
- Add that account as direct member to subgroup B
- Observe that you cannot chose anything lower than
Developer
Example Project
https://gitlab.com/groups/gl-demo-ultimate-mgrabowski/zd-446829 and https://gitlab.com/groups/gl-demo-ultimate-mgrabowski/zd-446829/subgroup is where I reproduced this
What is the current bug behavior?
Role selection is determined by a pending access request as if it was actual membership
What is the expected correct behavior?
Role selection should not be influenced by pending access request
Relevant logs and/or screenshots
Default after the access request: Nothing below Developer is available:
When I change the Max role in the access request to Owner, only that option remains available for the direct membership (the Developer is just there because it still is the current value):
Output of checks
This bug happens on GitLab.com
Possible fixes
I guess that validRoles here contains the incorrect data already, but I could not figure out where that is actually coming from/calculated.

