Add Importer User for imports user mapping
What does this MR do and why?
This MR adds Import user to a top level group with a new user type import_user
. A new Gitlab::Import::ImportUserCreator
is added to provision import_user
to a root group so that it can be used when doing user mapping when we can't assign imported data to placeholder users.
It:
- Creates import user on a root group level for a portable provided (root group/subgroup/project)
- Returns existing import user if it's present
- Raises if provided portable doesn't have a root group
- Raises if user has no permission to
admin_group
root group - Raises if import user failed to be persisted
Created import user doesn't appear in the list of billable users.
Mentions #443553 (closed)
[4] pry(main)> Gitlab::Import::ImportUserCreator.new(current_user: User.first, portable: Project.last).execute
=> #<User id:70 @import_user_group_9_dd85106ade8f8cdffb6dd93d0bb35e26>
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Open rails console
- Run
Gitlab::Import::ImportUserCreator.new(User.first, Group.find_by_full_path('mygroup')).execute
with your user and group - Observe import user is created
Edited by George Koltsov