summaryrefslogtreecommitdiff
path: root/lib/api/environments.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/environments.rb')
-rw-r--r--lib/api/environments.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/api/environments.rb b/lib/api/environments.rb
index 5c63ec028d9..fa828f43001 100644
--- a/lib/api/environments.rb
+++ b/lib/api/environments.rb
@@ -89,9 +89,10 @@ module API
requires :environment_id, type: Integer, desc: 'The environment ID'
end
post ':id/environments/:environment_id/stop' do
- authorize! :create_deployment, user_project
+ authorize! :read_environment, user_project
environment = user_project.environments.find(params[:environment_id])
+ authorize! :stop_environment, environment
environment.stop_with_action!(current_user)