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-04 12:33:29 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2016-02-19 15:18:47 +0300
commit553bac57d01f103f3f419e8096f30f422781adce (patch)
treebadb3f03a25d930ac2bacd268107b951880de3f3
parentdc32af950821946f5bc3a4e57b4b7eeb0ffb032f (diff)
Add token to runner details output in API
-rw-r--r--doc/api/runners.md1
-rw-r--r--lib/api/entities.rb1
-rw-r--r--lib/api/runners.rb2
3 files changed, 3 insertions, 1 deletions
diff --git a/doc/api/runners.md b/doc/api/runners.md
index 8e7351d01ec..926c46eb8ed 100644
--- a/doc/api/runners.md
+++ b/doc/api/runners.md
@@ -126,6 +126,7 @@ Example response:
"path": "gitlab-org/gitlab-ce"
}
],
+ "token": "205086a8e3b9a2b818ffac9b89d102",
"revision": null,
"tag_list": [
"ruby",
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 0170fa5a654..af030159580 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -387,6 +387,7 @@ module API
expose :tag_list
expose :version, :revision, :platform, :architecture
expose :contacted_at, as: :last_contact
+ expose :token, if: lambda { |runner, options| options[:user_is_admin] || !runner.is_shared? }
expose :projects, with: Entities::RunnerProjectDetails
end
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 284909c8db4..15782474369 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -33,7 +33,7 @@ module API
runner = get_runner(params[:id])
can_show_runner?(runner) unless current_user.is_admin?
- present runner, with: Entities::RunnerDetails
+ present runner, with: Entities::RunnerDetails, user_is_admin: current_user.is_admin?
end
# Update runner's details