diff options
author | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-10-29 18:58:19 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-10-29 18:58:19 +0300 |
commit | 077f2c6c432342ce4d011583e86d671b2b326a56 (patch) | |
tree | c483d253d30858ed467fcf7e17cd2e1d1750881b /spec/services/projects | |
parent | cd284fef90c6c4980ecfd5e06c6344dbe7ca8b95 (diff) | |
parent | 39c99361b655998aaca2114da3e9664c2da27f85 (diff) |
Merge branch 'security-developer-transfer-project' into 'master'
Require Maintainer permission on group where project is transferred to
See merge request gitlab/gitlabhq!3420
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/transfer_service_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 26d8ac9b479..298867f483b 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -222,6 +222,24 @@ describe Projects::TransferService do it { expect(project.errors[:new_namespace]).to include('Project with same name or path in target namespace already exists') } end + context 'target namespace allows developers to create projects' do + let(:group) { create(:group, project_creation_level: ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS) } + + context 'the user is a member of the target namespace with developer permissions' do + subject(:transfer_project_result) { transfer_project(project, user, group) } + + before do + group.add_developer(user) + end + + it 'does not allow project transfer to the target namespace' do + expect(transfer_project_result).to eq false + expect(project.namespace).to eq(user.namespace) + expect(project.errors[:new_namespace]).to include('Transfer failed, please contact an admin.') + end + end + end + def transfer_project(project, user, new_namespace) service = Projects::TransferService.new(project, user) |