summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index af030159580..a8c00542d35 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -388,7 +388,13 @@ module API
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
+ expose :projects, with: Entities::RunnerProjectDetails do |runner, options|
+ if options[:user_is_admin]
+ runner.projects
+ else
+ runner.projects.where(id: options[:available_projects_ids])
+ end
+ end
end
class Build < Grape::Entity