From 24eed1c5c1cbbad7081625ad98d06d151933f583 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 10 Feb 2016 12:26:56 +0100 Subject: Modify runner projects selecting method in runners API --- lib/api/entities.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/api/entities.rb') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index a8c00542d35..3f1594994c9 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -387,12 +387,12 @@ 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 :token, if: lambda { |runner, options| options[:current_user].is_admin? || !runner.is_shared? } expose :projects, with: Entities::RunnerProjectDetails do |runner, options| - if options[:user_is_admin] + if options[:current_user].is_admin? runner.projects else - runner.projects.where(id: options[:available_projects_ids]) + options[:current_user].authorized_projects.where(id: runner.projects) end end end -- cgit v1.2.1