Skip to content

Hide artifact delete button if no permission

Miranda Fluharty requested to merge 382078-check-delete-permission into master

What does this MR do and why?

For #382078 (closed)

This page is behind the artifacts_management_page feature flag.

This MR hides the delete buttons from the artifacts management page unless the user has permission to delete them (can?(current_user, :destroy_artifacts, @project)).

Screenshots or screen recordings

with permission without permission
Screenshot_2023-01-11_at_11.34.13 delete buttons at the job level and the file level Screenshot_2023-01-11_at_11.34.43 no delete buttons

How to set up and validate locally

  1. git checkout 382078-check-delete-permission
  2. echo "Feature.enable(:artifacts_management_page)" | bundle exec rails console
  3. navigate to a project, run a pipeline that generates artifacts
  4. in the sidebar select CI/CD => Artifacts
  5. once the list of jobs and their artifact files appear on the page, you should see delete buttons next to them (assuming you have permission because you set up this project/pipeline)
  6. open the same page in a new private browsing session, you should not see delete buttons next to jobs and artifacts (because you are not logged in and therefore cannot have permission to delete artifacts)

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 Miranda Fluharty

Merge request reports