Skip to content

Ensure members mapper always runs on Project Import

George Koltsov requested to merge georgekoltsov/always-run-members-mapper into master

What does this MR do?

This MR fixes a bug where project members are not added to the Imported Project, if a project does not have any issues/MRs/other relations that users can author.

Consider the following scenario:

  1. A user creates an empty project (with or without repository)
  2. Same user invites several users to members
  3. User exports and imports created project
  4. Members list of imported project will only include project creator

This is happening because members_mapper.map never ran https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/base/relation_factory.rb#L115-114

Even if project members never authored anything, it should still be possible to import project members. For this reason, I am adding mapping of users before relation tree restoration, so that all members are added before any relation is created. This will ensure that even if there are no issues or MRs in the projects, users are still being added as members (when performing import as admin that is as per https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/members_mapper.rb#L7-6)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by RAMAKRISHNAN HARIHARAN

Merge request reports