Hide new role button on roles and permissions page for Premium license

What does this MR do and why?

On the Admin area -> Roles and permissions page, or the top-level group -> Roles and permissions page, a New role button is shown:

Admin area R&P page Top-level group R&P page
ksnip_20250725-123225 ksnip_20250725-123124

The R&P page is available for Premium and Ultimate licenses, but the custom roles feature is only available for Ultimate. For Premium, the page should only show standard roles, with no ability to create custom roles. This MR fixes the following bugs:

  1. Fixed the New role button incorrectly showing for Premium licenses:

    Before After
    ksnip_20250725-125623 ksnip_20250725-125702

    Note that this is a display bug; even without the bugfix, it will show a 404 page when the button is clicked. The bugfix simply hides the button.

  2. Fixed the New role button incorrectly hidden for the SaaS admin page, it's now shown.

  3. Fixed a bug where the admin area Roles and permissions sidebar menu item was shown when in SaaS mode and the custom_admin_roles feature flag is off. For SaaS, the admin area R&P page only shows custom admin roles, so with the feature flag off the sidebar item menu item shouldn't be shown:

    Before After
    ksnip_20250725-135357 ksnip_20250725-135242

    Like the above bug, this is a display bug only; even without the bugfix, clicking on the menu item will show a 404 page.

How to set up and validate locally

You will need a self-managed Premium license. Follow this handbook page on how to acquire one. There are 5 situations we need to verify:

  1. For self-managed on an Ultimate license, the New role button is shown:

2025-07-25_14-18-33

  1. For self-managed on a Premium license, the `New role button is not shown:

2025-07-25_14-21-02

For the SaaS tests, follow this setup video:

2025-07-25_14-51-08

  1. For SaaS for a top-level group on an Ultimate license, the New role button is shown:

2025-07-25_14-52-49

  1. For SaaS for a top-level group on a Premium license, the New role button is not shown:

2025-07-25_14-53-36

  1. For SaaS, when viewing the admin area, the Roles and permission sidebar item is only shown when the custom_admin_roles feature flag is enabled:

2025-07-25_14-57-41

Related to #546035 (closed)

Edited by Daniel Tian

Merge request reports

Loading