Authorize users into imported GitLab project
This commit is contained in:
parent
5fedc46343
commit
4e0a0d093d
3 changed files with 14 additions and 2 deletions
|
@ -63,6 +63,7 @@ class Member < ActiveRecord::Base
|
||||||
after_create :send_request, if: :request?, unless: :importing?
|
after_create :send_request, if: :request?, unless: :importing?
|
||||||
after_create :create_notification_setting, unless: [:pending?, :importing?]
|
after_create :create_notification_setting, unless: [:pending?, :importing?]
|
||||||
after_create :post_create_hook, 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_update :post_update_hook, unless: [:pending?, :importing?]
|
||||||
after_destroy :post_destroy_hook, unless: :pending?
|
after_destroy :post_destroy_hook, unless: :pending?
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Authorize users into imported GitLab project
|
||||||
|
merge_request:
|
||||||
|
author:
|
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe Gitlab::ImportExport::MembersMapper, services: true do
|
describe Gitlab::ImportExport::MembersMapper, services: true do
|
||||||
describe 'map members' 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(: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_user_id) { 99 }
|
||||||
let(:exported_members) do
|
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
|
expect(ProjectMember.find_by_invite_email('invite@test.com')).not_to be_nil
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue