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
- Implements Allow access to /admin by default when user has... (#536133 - closed).
- Will be followed up by !189132 (merged)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Enable feature flag
$ rails c > Feature.enable(:custom_admin_roles) - Create a new admin member role with
read_admin_cicdpermission enabled> admin_member_role = MemberRole.create(name: 'Test', description: 'Test', read_admin_cicd: true) - 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)` - Login with an admin and enable Admin Mode
- Login with the user and turn on Admin Mode for the current session
- Click global search in left sidebar ("Search or go to"). Click "Admin area" menu item.
- Verify that you are redirected to
/adminandOverview > Dashboardmenu 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