Skip to content

Hides package registry bulk deletion for users without permission

What does this MR do and why?

Hides package registry bulk deletion for users without permission

This MR uses the permissions injected via availability of settingsPath

Screenshots or screen recordings

Without permission

Before After
Screenshot_2023-07-05_at_1.33.48_pm Screenshot_2023-07-05_at_1.35.46_pm

How to set up and validate locally

  1. Publish few packages with same name & different versions, as mentioned in https://gitlab.com/gitlab-org/ci-cd/package-stage/package/-/wikis/Packages-Tips-&-Tricks#how-to-create-a-list-of-packages-artificially
    1. rails c - Open the rails console

    2. p = Project.find(1) - Find one of your GDK projects. Project id can be found on the project home page

    3. FactoryBot.create_list(:npm_package, 10, project: p, name: p.name) - Creates 10 npm packages

    4. Add this line if above fails during the creation of files

       def fixture_file_upload(*args, **kwargs)
         Rack::Test::UploadedFile.new(*args, **kwargs)
       end
  2. View projects & groups package list page as admin/owner/maintainer - Should be possible to bulk delete & delete packages from UI.
  3. View projects & groups package list page as developer/reporter - Should not be possible to bulk delete & delete packages from UI.

MR acceptance checklist

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

Closes #388076

Edited by Rahul Chanila

Merge request reports