Fix: Users with roles lower than Maintainer should not be listed in the `Allowed to deploy` dropdown.

Summary of Changes

1. Updated EnvironmentDropdownService

  • Modified roles_hash and roles methods to accept a container parameter (project or group).
  • Added logic to exclude DEVELOPER role for group-level configurations using the new group_human_access_levels method.

2. Updated Calling Locations

  • In Projects and Groups, updated calls to EnvironmentDropdownService.roles_hash to pass the correct container (project or group).
  • Encapsulated group variable 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 🤖

Merge request reports

Loading