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:
parent
8b73df0cf5
commit
66e18a1284
2 changed files with 2 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue