summaryrefslogtreecommitdiff
path: root/app/policies/environment_policy.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
commit5064bf8c5647d4c4430cbb4d097cf1592416de29 (patch)
treed051bf2abe2cc7061b3a7facb6669a56ccb9cf54 /app/policies/environment_policy.rb
parent9c83aadd2604e7e6cb1f84683f951e6b12872618 (diff)
downloadgitlab-ce-5064bf8c5647d4c4430cbb4d097cf1592416de29.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/environment_policy.rb')
-rw-r--r--app/policies/environment_policy.rb6
1 files changed, 6 insertions, 0 deletions
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')