Commit 8116e400 authored by Douwe Maan's avatar Douwe Maan

Don't skip authorization when stopping CI environments

parent 9d7c5e75
...@@ -5,7 +5,7 @@ class EnvironmentsFinder ...@@ -5,7 +5,7 @@ class EnvironmentsFinder
@project, @current_user, @params = project, current_user, params @project, @current_user, @params = project, current_user, params
end end
def execute(skip_authorization: false) def execute
deployments = project.deployments deployments = project.deployments
deployments = deployments =
if ref if ref
...@@ -36,13 +36,9 @@ class EnvironmentsFinder ...@@ -36,13 +36,9 @@ class EnvironmentsFinder
end end
end end
unless skip_authorization environments.select do |environment|
environments.select! do |environment| Ability.allowed?(current_user, :read_environment, environment)
Ability.allowed?(current_user, :read_environment, environment)
end
end end
environments
end end
private private
......
...@@ -23,7 +23,7 @@ module Ci ...@@ -23,7 +23,7 @@ module Ci
def environments def environments
@environments ||= @environments ||=
EnvironmentsFinder.new(project, nil, ref: @ref, recently_updated: true).execute(skip_authorization: true) EnvironmentsFinder.new(project, current_user, ref: @ref, recently_updated: true).execute
end end
end end
end end
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