Don't check permission when creating project labels during transfer

What does this MR do and why?

Modified label transfer functionality: Updated the label transfer service to skip authorization checks when creating or finding labels during the transfer process. This change also reformatted the code to be more readable by splitting long method calls across multiple lines.

We already pass skip_authorization: true in various places where labels are created in an automated fashion (e.g. Project#create_labels, IncidentManagement::CreateIncidentSlaExceededLabelService#execute, Gitlab::IssuesLabels.generate, Gitlab::BitbucketImport::Importers::RepositoryImporter#create_labels, Gitlab::FogbugzImport::Importer#create_label) so it seems logical to also use it in Labels::TransferService#find_or_create_label!.

References

Related to Group transfer failure via API when group has a... (#554868 - closed).

How to set up and validate locally

  1. Create group a
  2. Create a group label label under the top-level group a
  3. Create subgroup a/aa
  4. Create project a/aa/aaa
  5. Create an issue under project a/aa/aaa and apply the label group label to it
  6. Archive project a/aa/aaa
  7. Create group b
  8. Transfer subgroup a/aa to the group b
  9. Transfer should succeed and the issue under b/aa/a should have the label label (b/aa/a project label created during the transfer from the a group)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rémy Coutable

Merge request reports

Loading