Fix: Users with roles lower than Maintainer should not be listed in the `Allowed to deploy` dropdown.
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Summary of Changes
1. Updated EnvironmentDropdownService
- Modified
roles_hashandrolesmethods to accept acontainerparameter (project or group). - Added logic to exclude
DEVELOPERrole for group-level configurations using the newgroup_human_access_levelsmethod.
2. Updated Calling Locations
- In Projects and Groups, updated calls to
EnvironmentDropdownService.roles_hashto pass the correct container (project or group). - Encapsulated
groupvariable in another function to abide with gitlab's policy to not use instance variables
3. Added/Updated Spec Tests
Enhanced test coverage for EnvironmentDropdownService to validate behavior for:
- Project Context: Both Developers and Maintainers are included.
- Group Context: Only Maintainers are included.
- Default Behavior: All roles are included when no container is provided.
Related to #481754 (closed)
Edited by 🤖 GitLab Bot 🤖