Skip to content

Add a single feature flag to control custom admin roles

What does this MR do and why?

Since custom admin roles are under active development, this MR introduces a single WIP feature flag to control the availability of all custom admin roles.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a new admin member role with read_admin_dashboard permission enabled
    admin_member_role = MemberRole.create(name: 'read_admin_subscription', description: 'read_admin_subscription', read_admin_subscription: true)
  2. Assign the role to a user. The command to find the user may differ from this example.
    user = User.find_by(username: 'read_admin_subscription')
    Users::UserMemberRole.create(member_role: admin_member_role, user: user)
  3. Test that the feature flag works as expected
    > Feature.disable(:custom_admin_roles)
    > User.find_by(username: 'read_admin_subscription').can?(:read_admin_subscription)
    => false
    
    > Feature.enable(:custom_admin_roles)
    > User.find_by(username: 'read_admin_subscription').can?(:read_admin_subscription)
    => true
Edited by Ian Anderson

Merge request reports

Loading