Commit a85b630f authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Make sure admin can remove projects

parent 53e70157
...@@ -210,7 +210,7 @@ module EE ...@@ -210,7 +210,7 @@ module EE
rule { owner | reporter }.enable :build_read_project rule { owner | reporter }.enable :build_read_project
rule { owner & owner_cannot_destroy_project }.prevent :remove_project rule { ~admin & owner & owner_cannot_destroy_project }.prevent :remove_project
rule { archived }.policy do rule { archived }.policy do
READONLY_FEATURES_WHEN_ARCHIVED.each do |feature| READONLY_FEATURES_WHEN_ARCHIVED.each do |feature|
......
...@@ -451,16 +451,23 @@ describe ProjectPolicy do ...@@ -451,16 +451,23 @@ describe ProjectPolicy do
end end
end end
describe 'remove_project when default_project_deletion_protection is set to true' do describe 'remove_project when default_project_deletion_protection is set to true' do
before do before do
allow(Gitlab::CurrentSettings.current_application_settings) allow(Gitlab::CurrentSettings.current_application_settings)
.to receive(:default_project_deletion_protection) { true } .to receive(:default_project_deletion_protection) { true }
end end
context 'with admin' do context 'with admin' do
let(:current_user) { admin } let(:current_user) { admin }
it { is_expected.to be_allowed(:remove_project) } it { is_expected.to be_allowed(:remove_project) }
context 'who owns the project' do
let(:current_user) { admin }
let(:project) { create(:project, :public, namespace: admin.namespace) }
it { is_expected.to be_allowed(:remove_project) }
end
end end
context 'with owner' do context 'with owner' do
......
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