Skip to content

Update Manage Licenses button show/hide logic in license compliance widget

- requested to merge 370058-fix-manage-licenses-button-permissions into master

What does this MR do and why?

As part of the feature flag rollout in production for the new license compliance MR widget #367703 (closed) I discovered a small un-released bug in production when a user is not a admin level role. No URL is provided to the frontend when you cannot manage a license, which makes sense.

The fix is is to not show the Manage Licenses button in the MR widget when a user does not have the correct permissions. The button would show but without a valid link. It was a no-op when you had the incorrect permission level.

Screenshots or screen recordings

When non admin roll

Before After
Screen_Shot_2022-08-06_at_11.28.31_PM Screen_Shot_2022-08-06_at_11.27.59_PM

When admin roll

Before After
Screen_Shot_2022-08-06_at_11.28.31_PM Screen_Shot_2022-08-06_at_11.28.31_PM

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

How to set up and validate locally

  • Reach out to me for a demo, or attempt steps below
  • In a rails console enable flag Feature.enable(:refactor_license_compliance_extension)
  • Clone the https://gitlab.com/gitlab-examples/security/security-reports project locally
  • Manually trigger the pipeline to run for Master. This can be done by going to the CI/CD -> Pipelines tab on the left nav and then clicking the Run Pipeline button.
  • Set up Allowed/Denied licenses in https://<localhost>/<group>/<project>/-/licenses#policies
  • Create a new MR. I suggest changing something simple like a letter or two in the README.md file. We just need a pipeline to complete and run. The sample project uses test reports to generate the data so doesn't matter what you change just need a MR.
  • Go to the MR and look for the license compliance widget as a user that is below admin level role.

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

MR acceptance checklist

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

Related to #370058 (closed)

Merge request reports

Loading