18004: Fixes a couple of race condition bugs related to caching remote users.
[arvados.git] / services / api / app / controllers / arvados / v1 / keep_services_controller.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class Arvados::V1::KeepServicesController < ApplicationController
6
7   skip_before_action :find_object_by_uuid, only: :accessible
8   skip_before_action :render_404_if_no_object, only: :accessible
9   skip_before_action :require_auth_scope, only: :accessible
10
11   def find_objects_for_index
12     # all users can list all keep services
13     @objects = KeepService.all
14     super
15   end
16
17   def accessible
18     if request.headers['X-External-Client'] == '1'
19       @objects = KeepService.where('service_type=?', 'proxy')
20     else
21       @objects = KeepService.where('service_type<>?', 'proxy')
22     end
23     render_list
24   end
25 end