1 class Arvados::V1::VirtualMachinesController < ApplicationController
2 skip_before_filter :find_object_by_uuid, :only => :get_all_logins
3 skip_before_filter(:require_auth_scope_all,
4 :only => [:logins, :get_all_logins])
5 before_filter(:admin_required,
6 :only => [:logins, :get_all_logins])
7 before_filter(:require_auth_scope_for_get_all_logins,
8 :only => [:logins, :get_all_logins])
16 User.includes(:authorized_keys).all.each do |u|
20 @vms = VirtualMachine.includes(:login_permissions)
22 @vms = @vms.where('uuid=?', @object.uuid)
27 vm.login_permissions.each do |perm|
28 user_uuid = perm.tail_uuid
29 @users[user_uuid].andand.authorized_keys.andand.each do |ak|
30 username = perm.properties.andand['username']
34 hostname: vm.hostname,
35 public_key: ak.public_key,
37 virtual_machine_uuid: vm.uuid,
38 authorized_key_uuid: ak.uuid
44 render json: { kind: "arvados#HashList", items: @response }
49 def require_auth_scope_for_get_all_logins
51 # Client wants all logins for a single VM.
52 require_auth_scope(['all', arvados_v1_virtual_machine_url(@object.uuid)])
54 # ...for a non-existent VM, or all VMs.
55 require_auth_scope(['all'])