Manual job page: Allow admins to set pipeline variables regardless of project role

What does this MR do and why?

This MR fixes the manual job page to allow admin users to set pipeline variables regardless of their project role. It changes the permission check from being re-implemented in the frontend to using the backend's determination.

Changes overview:

  1. Removed the PipelineVariablesPermissionsMixin from components and replaced it with a direct inject of canSetPipelineVariables from the backend
  2. Updated the jobs_helper.rb to provide the permission status directly from the backend using Ability.allowed?
  3. Updated the manual.rb status class to include the pipeline variables message when the user can set pipeline variables (this is a revert to the previous implementation as we don't need to split this text between the backend and frontend anymore).

References

This MR is part of a larger effort to fix the issue where admin users cannot modify pipeline variables unless they have at least developer access to the project. This was caused by a migration in 17.10 that changed project settings from restrict_user_defined_variables: false to restrict_user_defined_variables: true, ci_pipeline_variables_minimum_override_role: :developer.

Screenshots or screen recordings

No visual changes

User can not set variables User can set variables
Screenshot 2025-04-15 at 22.17.59.png Screenshot 2025-04-15 at 22.15.58.png
Screenshot 2025-04-15 at 22.17.40.png Screenshot 2025-04-15 at 22.17.27.png

How to set up and validate locally

  1. Visit a project as admin where the admin is not a member (or has at maximum reporter role)
  2. Open the CI/CD > Variables Settings and set Minimum role to use pipeline variables to No one allowed
  3. Open the create pipeline schedule page and observe that the variables section is not present
  4. Open the CI/CD > Variables Settings and set Minimum role to use pipeline variables to any other option
  5. Open the create pipeline schedule page and observe that the variables section is present

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #536292 (closed)

Edited by Anna Vovchenko

Merge request reports

Loading