Skip to content

Fix check for default member

What does this MR do and why?

Solves #30437 (closed)

What I found out was that, when creating a project from a template, the access level is initially set correctly to Developer. After the job that imports the project (RepositoryImportWorker) executes though, the role is incorrectly changed to Maintainer.

The reason is that lib/gitlab/import_export/members_mapper.rb is deleting all memberships and recreating them with the project creator as Maintainer, if the project creator is not the first project member or not a Maintainer. What it probably wanted to do is to ensure:

  • that the project creator is a project member
  • and that there is at least one member with Maintainer or Owner role, no matter if it is the project creator.

This MR fixes that and ensures both of the point above.

How to set up and validate locally

  1. Create a Group
  2. Add a Member to the Group with Developer access level
  3. Sign out and then sign in as that Member
  4. Create a Project in the Group using the "Create from template" tab
  5. Check the access level of the Member on the newly created project (it should be Developer) -->

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 Magdalena Frankiewicz

Merge request reports