summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-02-02 15:52:02 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-02-19 13:18:47 +0100
commit81ced6f55b1ab847bbb21da9c43410340c95c2b3 (patch)
tree7b98c9f8a1d6b6d148f44e69d2bcb9b6767c216b /lib/api
parentb56ee397bb5fa32e3a53fdaee3d6592f1486d7f1 (diff)
downloadgitlab-ce-81ced6f55b1ab847bbb21da9c43410340c95c2b3.tar.gz
Split `/runners` entrypoint to `/runners` and `/runners/all`
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/runners.rb21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index f4f8f2f2247..284909c8db4 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -4,19 +4,22 @@ module API
before { authenticate! }
resource :runners do
- # Get available shared runners
+ # Get runners available for user
#
# Example Request:
# GET /runners
get do
- runners =
- if current_user.is_admin?
- Ci::Runner.all
- else
- current_user.ci_authorized_runners
- end
-
- runners = filter_runners(runners, params[:scope])
+ runners = filter_runners(current_user.ci_authorized_runners, params[:scope])
+ present paginate(runners), with: Entities::Runner
+ end
+
+ # Get all runners - shared and specific
+ #
+ # Example Request:
+ # GET /runners/all
+ get 'all' do
+ authenticated_as_admin!
+ runners = filter_runners(Ci::Runner.all, params[:scope])
present paginate(runners), with: Entities::Runner
end