Skip to content

Add read_admin_cicd custom permission to allow access to /admin/runners

What does this MR do and why?

This MR partially implements Implement granular read_admin_cicd permission (#507960 - closed). It includes the following changes:

  • Add read_admin_cicd custom ability.
  • Displays a link to "Admin area" in global search results when a non-admin user has read_admin_cicd permission. This links to /admin/runners if the user only has access to /admin/runners but not /admin (granted by read_admin_dashboard, for example).
  • Allows access to /admin/runners when a non-admin user has read_admin_cicd permission.

This MR does not include the following:

  • Updates to grant access to /admin/jobs which is also under the CI/CD admin page
  • Updates to grant access when fetching all runners displayed in /admin/runners
  • Updates to grant access when fetching all jobs displayed in /admin/jobs

These will be introduced in a separate MR to keep this MR small.

References

MR acceptance checklist

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

Screenshots or screen recordings

Screen_Recording_2025-01-10_at_2.22.49_PM

How to set up and validate locally

  1. Enable custom_ability_read_admin_cicd feature flag.
    $ rails c
    > Feature.enable(:custom_ability_read_admin_cicd)
  2. Create a new admin member role with read_admin_cicd permission enabled.
    > admin_member_role = MemberRole.create(name: 'Limited admin', description: 'Read CI/CD details including runners and jobs.', read_admin_cicd: true)
  3. Assign the new admin role to a non-admin user.
    > user = User.find(<a_user_id>)
    > Users::UserMemberRole.create(member_role: admin_member_role, user: user)`
  4. Login with the user.
  5. Click global search in left sidebar ("Search or go to").
  6. Verify that "Admin area" is displayed. Click on it.
  7. Verify that you are redirected to /admin/runners and CI/CD menu item is the only one displayed on the side bar.
Edited by Eugie Limpin

Merge request reports

Loading