summaryrefslogtreecommitdiff
path: root/app/services/ci/stop_environments_service.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-12 13:48:43 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-12 13:48:43 +0200
commit2aa211fa69ffd02ba11757e06e19d34f6ca51865 (patch)
treecba18999257837397d1a0bcfb8e6e3de843362ff /app/services/ci/stop_environments_service.rb
parent55aa727eff50a9472405b302645abb54f28bdba0 (diff)
downloadgitlab-ce-2aa211fa69ffd02ba11757e06e19d34f6ca51865.tar.gz
Use build policy to determine if user can play build
Diffstat (limited to 'app/services/ci/stop_environments_service.rb')
-rw-r--r--app/services/ci/stop_environments_service.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/services/ci/stop_environments_service.rb b/app/services/ci/stop_environments_service.rb
index d1e341bc9b5..bd9735fc0ac 100644
--- a/app/services/ci/stop_environments_service.rb
+++ b/app/services/ci/stop_environments_service.rb
@@ -9,7 +9,8 @@ module Ci
return unless can?(current_user, :create_deployment, project)
environments.each do |environment|
- next unless environment.can_trigger_stop_action?(current_user)
+ next unless environment.stop_action?
+ next unless can?(current_user, :play_build, environment.stop_action)
environment.stop_with_action!(current_user)
end