diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 09:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 09:08:59 +0300 |
commit | 63c450b3e417739ddbe0bf89a6f843074e35c66c (patch) | |
tree | 4119094a8223f0e501a5cf28f6bffebea26b231b /app/finders | |
parent | f51c6a69f9804d1dde7a0f1717a91ca97001f871 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/ci/runners_finder.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/finders/ci/runners_finder.rb b/app/finders/ci/runners_finder.rb index d0d98a59677..d2e8f5c2a4c 100644 --- a/app/finders/ci/runners_finder.rb +++ b/app/finders/ci/runners_finder.rb @@ -10,6 +10,7 @@ module Ci def initialize(current_user:, params:) @params = params @group = params.delete(:group) + @project = params.delete(:project) @current_user = current_user end @@ -36,7 +37,13 @@ module Ci private def search! - @group ? group_runners : all_runners + if @project && Feature.enabled?(:on_demand_scans_runner_tags, @project) + project_runners + elsif @group + group_runners + else + all_runners + end @runners = @runners.search(@params[:search]) if @params[:search].present? end @@ -66,6 +73,12 @@ module Ci end end + def project_runners + raise Gitlab::Access::AccessDeniedError unless can?(@current_user, :admin_project, @project) + + @runners = ::Ci::Runner.owned_or_instance_wide(@project.id) + end + def filter_by_active! @runners = @runners.active(@params[:active]) if @params.include?(:active) end |