Don't add admins as masters to projects created in another user's namespace

Only admins have the ability to create a project in another user's personal
namespace. Prior to this commit, we were explicitly adding them as masters to
the project. However, admins already have access (by virture of being admins),
so this is unnecessary.
This commit is contained in:
Nick Thomas 2017-08-25 16:21:27 +01:00
parent 8b73df0cf5
commit 66e18a1284
2 changed files with 2 additions and 3 deletions

View file

@ -112,8 +112,7 @@ module Projects
if group || @project.gitlab_project_import? if group || @project.gitlab_project_import?
current_user.refresh_authorized_projects current_user.refresh_authorized_projects
else else
owners = [current_user, @project.namespace.owner].compact.uniq @project.add_master(@project.namespace.owner, current_user: current_user)
@project.add_master(owners, current_user: current_user)
end end
end end

View file

@ -38,7 +38,7 @@ describe Projects::CreateService, '#execute' do
expect(project).to be_persisted expect(project).to be_persisted
expect(project.owner).to eq(user) expect(project.owner).to eq(user)
expect(project.team.masters).to include(user, admin) expect(project.team.masters).to contain_exactly(user)
expect(project.namespace).to eq(user.namespace) expect(project.namespace).to eq(user.namespace)
end end
end end