1 class Arvados::V1::KeepDisksController < ApplicationController
2 skip_before_filter :require_auth_scope, only: :ping
3 skip_before_filter :render_404_if_no_object, only: :ping
5 def self._ping_requires_parameters
7 uuid: {required: false},
8 ping_secret: {required: true},
9 node_uuid: {required: false},
10 filesystem_uuid: {required: false},
11 service_host: {required: false},
12 service_port: {required: true},
13 service_ssl_flag: {required: true}
18 params[:service_host] ||= request.env['REMOTE_ADDR']
19 if !params[:uuid] && current_user.andand.is_admin
20 # Create a new KeepDisk and ping it.
21 @object = KeepDisk.new(filesystem_uuid: params[:filesystem_uuid])
24 # In the first ping from this new filesystem_uuid, we can't
25 # expect the keep node to know the ping_secret so we made sure
26 # we got an admin token. Here we add ping_secret to params so
27 # the ping call below is properly authenticated.
28 params[:ping_secret] = @object.ping_secret
31 if !@object.andand.ping(params)
32 return render_not_found "object not found"
34 # Render the :superuser view (i.e., include the ping_secret) even
35 # if !current_user.is_admin. This is safe because @object.ping's
36 # success implies the ping_secret was already known by the client.
37 send_json @object.as_api_response(:superuser)
41 def find_objects_for_index
42 # all users can list all keep disks
43 @objects = model_class.where('1=1')