From 5064bf8c5647d4c4430cbb4d097cf1592416de29 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 25 Mar 2020 09:08:11 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/policies/environment_policy.rb | 6 ++++++ app/policies/project_policy.rb | 2 ++ 2 files changed, 8 insertions(+) (limited to 'app/policies') diff --git a/app/policies/environment_policy.rb b/app/policies/environment_policy.rb index be512dd3b94..f0187a39687 100644 --- a/app/policies/environment_policy.rb +++ b/app/policies/environment_policy.rb @@ -12,7 +12,13 @@ class EnvironmentPolicy < BasePolicy !@subject.stop_action_available? && can?(:update_environment, @subject) end + condition(:stopped) do + @subject.stopped? + end + rule { stop_with_deployment_allowed | stop_with_update_allowed }.enable :stop_environment + + rule { ~stopped }.prevent(:destroy_environment) end EnvironmentPolicy.prepend_if_ee('EE::EnvironmentPolicy') diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index aecefcc89ab..99aeca17699 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -271,6 +271,7 @@ class ProjectPolicy < BasePolicy enable :destroy_container_image enable :create_environment enable :update_environment + enable :destroy_environment enable :create_deployment enable :update_deployment enable :create_release @@ -316,6 +317,7 @@ class ProjectPolicy < BasePolicy enable :create_deploy_token enable :read_pod_logs enable :destroy_deploy_token + enable :read_prometheus_alerts end rule { (mirror_available & can?(:admin_project)) | admin }.enable :admin_remote_mirror -- cgit v1.2.1