Merge branch '1977-provenance-report' of git.clinicalfuture.com:arvados into 1977...
[arvados.git] / apps / workbench / app / controllers / virtual_machines_controller.rb
1 class VirtualMachinesController < ApplicationController
2   def index_pane_list
3     %w(recent help)
4   end
5   def index
6     @objects ||= model_class.all
7     @vm_logins = {}
8     if @objects.andand.first
9       Link.where(tail_uuid: current_user.uuid,
10                  head_uuid: @objects.collect(&:uuid),
11                  link_class: 'permission',
12                  name: 'can_login').
13         each do |perm_link|
14         if perm_link.properties.andand[:username]
15           @vm_logins[perm_link.head_uuid] ||= []
16           @vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
17         end
18       end
19       @objects.each do |vm|
20         vm.current_user_logins = @vm_logins[vm.uuid].andand.compact || []
21       end
22     end
23     super
24   end
25 end