1 class Arvados::V1::KeepDisksController < ApplicationController
2 skip_before_filter :require_auth_scope_all, :only => :ping
4 def self._ping_requires_parameters
9 filesystem_uuid: false,
12 service_ssl_flag: true
16 params[:service_host] ||= request.env['REMOTE_ADDR']
17 if not @object.ping params
18 return render_not_found "object not found"
20 # Render the :superuser view (i.e., include the ping_secret) even
21 # if !current_user.is_admin. This is safe because @object.ping's
22 # success implies the ping_secret was already known by the client.
23 render json: @object.as_api_response(:superuser)
26 def find_objects_for_index
27 # all users can list all keep disks
28 @objects = model_class.where('1=1')
32 def find_object_by_uuid
33 @object = KeepDisk.where(uuid: (params[:id] || params[:uuid])).first
34 if !@object && current_user.andand.is_admin
35 # Create a new KeepDisk and ping it.
36 @object = KeepDisk.new(filesystem_uuid: params[:filesystem_uuid])
39 # In the first ping from this new filesystem_uuid, we can't
40 # expect the keep node to know the ping_secret so we made sure
41 # we got an admin token. Here we add ping_secret to params so
42 # KeepNode.ping() understands this update is properly
44 params[:ping_secret] = @object.ping_secret