Add User on Import if required
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=36683) </details> <!--IssueSummary end--> ### Problem to solve While trying to import a project on behalf of a prospect/customer in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8383, we got this error: `Unable to save project. Error: Error importing repository into project/path - Error adding importer user to project members. Validation failed: Source can't be blank` From what I can tell, it's because the user specified as the importer was not in the list of project members at the Maintainer level. ### Further details for more details, see https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8383#note_245829470 ### Proposal Auto add the user that is importing the project to the list of project members at the Maintainer level since they are "creating" the project. ### Permissions and Security Right now https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/members_mapper.rb#L52 throws the error if the user is not in the list of project members. It may be considered a security issue if you're auto-added, but with enough knowledge, a user could manually edit the json file to do so anyway. ### Testing <!-- What risks does this change pose? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing? See the test engineering process for further help: https://about.gitlab.com/handbook/engineering/quality/test-engineering/ --> ### What does success look like, and how can we measure that? Error is not thrown, and project is imported.
issue