diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-06 11:48:41 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-06 11:48:41 +0000 |
commit | dc5af2ec202a96c45af61e7e38fafebd569f0c36 (patch) | |
tree | 1620d7ee65d1bee4db01e438fba4fad25b70561a | |
parent | 18201ace36f13eb916737154178d700feb4eeec6 (diff) | |
parent | 4e0a0d093d7a4290a59523238990bf96b1b89313 (diff) | |
download | gitlab-ce-dc5af2ec202a96c45af61e7e38fafebd569f0c36.tar.gz |
Merge branch 'fix/authorize-users-into-imported-gitlab-project' into 'master'
Authorize users into imported GitLab project
https://gitlab.com/gitlab-com/support-forum/issues/1313
See merge request !7936
-rw-r--r-- | app/models/member.rb | 1 | ||||
-rw-r--r-- | changelogs/unreleased/fix-authorize-users-into-imported-gitlab-project.yml | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/members_mapper_spec.rb | 11 |
3 files changed, 14 insertions, 2 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index df93aaee847..3b65587c66b 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -63,6 +63,7 @@ class Member < ActiveRecord::Base after_create :send_request, if: :request?, unless: :importing? after_create :create_notification_setting, unless: [:pending?, :importing?] after_create :post_create_hook, unless: [:pending?, :importing?] + after_create :refresh_member_authorized_projects, if: :importing? after_update :post_update_hook, unless: [:pending?, :importing?] after_destroy :post_destroy_hook, unless: :pending? diff --git a/changelogs/unreleased/fix-authorize-users-into-imported-gitlab-project.yml b/changelogs/unreleased/fix-authorize-users-into-imported-gitlab-project.yml new file mode 100644 index 00000000000..9f14463fdd1 --- /dev/null +++ b/changelogs/unreleased/fix-authorize-users-into-imported-gitlab-project.yml @@ -0,0 +1,4 @@ +--- +title: Authorize users into imported GitLab project +merge_request: +author: diff --git a/spec/lib/gitlab/import_export/members_mapper_spec.rb b/spec/lib/gitlab/import_export/members_mapper_spec.rb index 770e8b0c2f4..1cb02f8e318 100644 --- a/spec/lib/gitlab/import_export/members_mapper_spec.rb +++ b/spec/lib/gitlab/import_export/members_mapper_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe Gitlab::ImportExport::MembersMapper, services: true do describe 'map members' do - let(:user) { create(:user) } + let(:user) { create(:user, authorized_projects_populated: true) } let(:project) { create(:project, :public, name: 'searchable_project') } - let(:user2) { create(:user) } + let(:user2) { create(:user, authorized_projects_populated: true) } let(:exported_user_id) { 99 } let(:exported_members) do [{ @@ -67,5 +67,12 @@ describe Gitlab::ImportExport::MembersMapper, services: true do expect(ProjectMember.find_by_invite_email('invite@test.com')).not_to be_nil end + + it 'authorizes the users to the project' do + members_mapper.map + + expect(user.authorized_project?(project)).to be true + expect(user2.authorized_project?(project)).to be true + end end end |