diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-24 15:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-24 15:09:00 +0300 |
commit | ae78b85a25cb0c19c3d6a2e4e6c7ca91ed50787d (patch) | |
tree | c53ad0fcdab26725814f1dc5267f6a04ebe4cf73 /lib/gitlab/import_export | |
parent | 38149afcf95e7669a7a99828c579d185b70c04dc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r-- | lib/gitlab/import_export/members_mapper.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/gitlab/import_export/members_mapper.rb b/lib/gitlab/import_export/members_mapper.rb index 2a70344374b..e7eae0a8c31 100644 --- a/lib/gitlab/import_export/members_mapper.rb +++ b/lib/gitlab/import_export/members_mapper.rb @@ -51,7 +51,7 @@ module Gitlab @importable.members.destroy_all # rubocop: disable DestroyAll - relation_class.create!(user: @user, access_level: relation_class::MAINTAINER, source_id: @importable.id, importing: true) + relation_class.create!(user: @user, access_level: highest_access_level, source_id: @importable.id, importing: true) rescue => e raise e, "Error adding importer user to #{@importable.class} members. #{e.message}" end @@ -59,7 +59,7 @@ module Gitlab def user_already_member? member = @importable.members&.first - member&.user == @user && member.access_level >= relation_class::MAINTAINER + member&.user == @user && member.access_level >= highest_access_level end def add_team_member(member, existing_user = nil) @@ -72,7 +72,7 @@ module Gitlab parsed_hash(member).merge( 'source_id' => @importable.id, 'importing' => true, - 'access_level' => [member['access_level'], relation_class::MAINTAINER].min + 'access_level' => [member['access_level'], highest_access_level].min ).except('user_id') end @@ -97,6 +97,12 @@ module Gitlab GroupMember end end + + def highest_access_level + return relation_class::OWNER if relation_class == GroupMember + + relation_class::MAINTAINER + end end end end |