Commit 66e18a12 authored by Nick Thomas's avatar Nick Thomas

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.
parent 8b73df0c
......@@ -112,8 +112,7 @@ module Projects
if group || @project.gitlab_project_import?
current_user.refresh_authorized_projects
else
owners = [current_user, @project.namespace.owner].compact.uniq
@project.add_master(owners, current_user: current_user)
@project.add_master(@project.namespace.owner, current_user: current_user)
end
end
......
......@@ -38,7 +38,7 @@ describe Projects::CreateService, '#execute' do
expect(project).to be_persisted
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)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment