Skip to content

Commit 553bac5

Browse files
committed
Add token to runner details output in API
1 parent dc32af9 commit 553bac5

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

doc/api/runners.md

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Example response:
126126
"path": "gitlab-org/gitlab-ce"
127127
}
128128
],
129+
"token": "205086a8e3b9a2b818ffac9b89d102",
129130
"revision": null,
130131
"tag_list": [
131132
"ruby",

lib/api/entities.rb

+1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ class RunnerDetails < Runner
387387
expose :tag_list
388388
expose :version, :revision, :platform, :architecture
389389
expose :contacted_at, as: :last_contact
390+
expose :token, if: lambda { |runner, options| options[:user_is_admin] || !runner.is_shared? }
390391
expose :projects, with: Entities::RunnerProjectDetails
391392
end
392393

lib/api/runners.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Runners < Grape::API
3333
runner = get_runner(params[:id])
3434
can_show_runner?(runner) unless current_user.is_admin?
3535

36-
present runner, with: Entities::RunnerDetails
36+
present runner, with: Entities::RunnerDetails, user_is_admin: current_user.is_admin?
3737
end
3838

3939
# Update runner's details

0 commit comments

Comments
 (0)