Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-02-05 17:35:21 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2016-02-19 15:18:47 +0300
commit36e7ffea5de84102a7306faf679cdb5b81920f19 (patch)
tree7ef2abe7ee211a87d13716ca2aa0685d5eb7d247 /lib/api/runners.rb
parent97c88966bb9594449a519d377203206dd6416868 (diff)
Fix runners filtering
Diffstat (limited to 'lib/api/runners.rb')
-rw-r--r--lib/api/runners.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 4a0e68a4ddb..e807d2eccf0 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -9,7 +9,7 @@ module API
# Example Request:
# GET /runners
get do
- runners = filter_runners(current_user.ci_authorized_runners, params[:scope])
+ runners = filter_runners(current_user.ci_authorized_runners, params[:scope], without: ['specific', 'shared'])
present paginate(runners), with: Entities::Runner
end
@@ -124,10 +124,14 @@ module API
end
helpers do
- def filter_runners(runners, scope)
+ def filter_runners(runners, scope, options = {})
return runners unless scope.present?
available_scopes = ::Ci::Runner::AVAILABLE_SCOPES
+ if options[:without]
+ available_scopes = available_scopes - options[:without]
+ end
+
if (available_scopes & [scope]).empty?
render_api_error!('Scope contains invalid value', 400)
end