Skip to content

Add user_permissions fields to PackageType and PackageDetailsType

What does this MR do and why?

This MR adds the new user_permissions fields to PackageType and PackageDetailsType that will supersede existing can_destroy field. And also marks existing can_destroy field as deprecated.

Screenshots or screen recordings

Screenshot_2023-10-27_at_18.11.31

How to set up and validate locally

Run the following steps in rails console.

  1. Create a new package.

    def fixture_file_upload(*args, **kwargs)
      Rack::Test::UploadedFile.new(*args, **kwargs)
    end
    
    p = FactoryBot.create(:npm_package)
    
    p.id # We will need the package's ID in the next step
  2. Visit http://gdk.test:3000/-/graphql-explorer and create a graphql query. The response should contain userPermissions field.

    query {
      package(id: "gid://gitlab/Packages::Package/<package_id>") {
        userPermissions {
          destroyPackage
        }
      }
    }

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 #390754 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports