Skip to content

User mapping - Placeholder User Type

For the improved user contribution mapping, contributions will be assigned to placeholder users, which will be a special type of user with limited access that will resemble the user in the source instance.

Such users will be created during the import and will hold information from the source instance that will be used to correlate the GitLab user with the source user. The table below shows the information that will be stored.

On this issue, we will do the following tasks

  • Add a new type of user called placeholder
  • Create the table that will store the user's source information
  • Create a service to create the placeholder users with the source information
  • Since the service will be used by all importers, placing the service in the Import module is sensible.

User details

The placeholder user that will be created in the user table, should be created using the following attribute values:

  • Name: "Placeholder #{source_name}"

  • Username: "%{source_username}_placeholder_user_%{unique_number}"

  • Email: %{source_username}_placeholder_user_%{unique_number}@gitlab.com

Table structure

Create a new table following the structure:

Field Type Note
user_id INTEGER (ALLOW NULL) GitLab user aka placeholder user. User ID will change to null after the reassignment as the placeholder user will be deleted
namespace_id INTEGER namespace associated to the user
source_username STRING
source_name STRING
source_user_id STRING? 🤔
source_hostname STRING
import_type STRING
reassign_to INTEGER (ALLOW NULL) User ID of the user that accepted the reassignment
created_at DATETIME
updated_at DATETIME

Note: (source_user_id + source_hostname + import_type + namespace_id) should be a unique index

Table name:

suggestions

  • placeholder_user
  • external_user
  • ???

Questions

BitBucket uses UUID for the user's ID. Is it better to keep the source_user_id as a STRING column so we can store any identifier on it, or have separate columns?

source_user_id won't be used as a foreign key, so it should be fine to be a string 🤔

Edited by Rodrigo Tomonari