Skip to content

Show custom role details in drawer

Daniel Tian requested to merge 4562730-show-custom-role-details-in-drawer into master

What does this MR do and why?

On the Manage -> Members page for any group/project, a list of members is shown. In the max role column, when the role name is clicked for a user, the role details will show in a drawer. In a previous MR, we added the base role details to the drawer, which only shows the role name and a link to the permissions doc page.

This MR adds in the custom role details, which shows the role description, the base role, and the enabled permissions for that role:

Members list Base role drawer Custom role drawer (what this MR changes)
ksnip_20240517-173205 ksnip_20240517-173244 ksnip_20240517-173231

How to set up and validate locally

  1. Go to Admin Area -> Settings -> Roles and Permissions.
  2. Click the New role button and create a new custom role.
  3. Go to either a group or project, then go to Manage -> Members.
  4. Click the Invite members button to bring up the invite modal. Select a standard role, then use the modal to invite a person.
  5. Invite another person, but this time select the custom role you created.
  6. Enable the show_role_details_in_drawer feature flag. Note that after enabling the feature flag, you will be unable to change the role assigned to a user.
echo "Feature.enable(:show_role_details_in_drawer)" | rails c
  1. In the members list, click on the user with the standard role. Verify that the drawer shows, and only the role name and the permissions link is shown.verify that the role names show up as links, and the user with the custom role has a Custom role badge below the role name.
  2. In the members list, click on the user with the custom role. Verify the following:
    • Role name is shown with Custom role badge to the right of it.
    • Role description is shown.
    • Base role is shown directly underneath permissions header, with the View permissions link to the right of it.
    • The role's enabled permissions are shown with a check icon, the permission name, and the permission description.

Related issue: #456273 (closed)

Edited by Daniel Tian

Merge request reports