Allow access to admin dashboard page to users with custom admin role

What does this MR do and why?

Instead of redirecting the user to a specific admin area depending on their custom admin permission (e.g. redirect to /admin/runners when user has read_admin_cicd permission), redirect a user with any custom admin role to the admin area dashboard (/admin).

See &15956 (comment 2455442974) for why we want to do this.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable feature flag
    $ rails c
    > Feature.enable(:custom_admin_roles)
  2. Create a new admin member role with read_admin_cicd permission enabled
    > admin_member_role = MemberRole.create(name: 'Test', description: 'Test', 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 an admin and enable Admin Mode
  5. Login with the user and turn on Admin Mode for the current session
  6. Click global search in left sidebar ("Search or go to"). Click "Admin area" menu item.
  7. Verify that you are redirected to /admin and Overview > Dashboard menu item is active on the sidebar

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.

Edited by Hinam Mehra

Merge request reports

Loading