提交 30d91511 编写于 作者: J James Lopez 提交者: Jan Provaznik

Fix issue importing members with owner access

上级 bd1ef521
---
title: Fix issue importing members with owner access
merge_request: 28636
author:
type: fixed
......@@ -23,6 +23,7 @@
> in the import side is required to map the users, based on email or username.
> Otherwise, a supplementary comment is left to mention the original author and
> the MRs, notes or issues will be owned by the importer.
> - Project members with owner access will get imported as maintainers.
> - Control project Import/Export with the [API](../../../api/project_import_export.md).
> - If an imported project contains merge requests originated from forks,
> then new branches associated with such merge requests will be created
......
......@@ -59,7 +59,11 @@ module Gitlab
end
def member_hash(member)
parsed_hash(member).merge('source_id' => @project.id, 'importing' => true)
parsed_hash(member).merge(
'source_id' => @project.id,
'importing' => true,
'access_level' => [member['access_level'], ProjectMember::MAINTAINER].min
)
end
def parsed_hash(member)
......
......@@ -73,6 +73,13 @@ describe Gitlab::ImportExport::MembersMapper do
expect(user2.authorized_project?(project)).to be true
end
it 'maps an owner as a maintainer' do
exported_members.first['access_level'] = ProjectMember::OWNER
expect(members_mapper.map[exported_user_id]).to eq(user2.id)
expect(ProjectMember.find_by_user_id(user2.id).access_level).to eq(ProjectMember::MAINTAINER)
end
context 'user is not an admin' do
let(:user) { create(:user) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册