Skip to content

Display unban action button when user has the necessary permission

Partially resolves https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/112

What does this MR do and why?

This MR fixes a bug wherein the Unban action button is not displayed when there is only one banned user in the banned group member table despite the current user having permission to unban. The bug exists because the table does not check the current user's canUnban permission for the member row when trying to hide the table's action column.

Screenshots or screen recordings

Before After
Screen_Shot_2022-10-17_at_11.18.41_AM Screen_Shot_2022-10-17_at_11.19.41_AM

How to set up and validate locally

  1. Ensure you are running GDK with an Ultimate license. The following command should log true if this is set up correctly
    echo "License.feature_available?(:unique_project_download_limit)" | rails c
  2. Turn on the feature flags:
    echo "Feature.enable(:limit_unique_project_downloads_per_namespace_user)" | rails c
  3. Create a top-level group
  4. Create a Group Access Token (instructions) with Developer role for the group you created
  5. Validate that the Group Access Token bot user is in the group's members table
  6. Ban the Group Access Token bot user via Rails console
    > group = Group.last # assuming the group you created in step 3 is the most recent group created
    > bot = User.find_by(username: "group_#{group.id}_bot") # assuming this is the first Group Access Token created for the group
    > ::Namespaces::NamespaceBan.create(user: bot, namespace: group)
  7. Validate that the Group Access Token bot user is displayed in the group's banned members table
  8. Validate that Unban button is displayed for the bot user row
    📸 Screen_Shot_2022-10-17_at_11.33.00_AM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports