summaryrefslogtreecommitdiff
path: root/lib/api/runners.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/runners.rb')
-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