8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / controllers / virtual_machines_controller.rb
1 class VirtualMachinesController < ApplicationController
2   def index
3     @objects ||= model_class.all
4     @vm_logins = {}
5     if @objects.andand.first
6       Link.where(tail_uuid: current_user.uuid,
7                  head_uuid: @objects.collect(&:uuid),
8                  link_class: 'permission',
9                  name: 'can_login').
10         each do |perm_link|
11         if perm_link.properties.andand[:username]
12           @vm_logins[perm_link.head_uuid] ||= []
13           @vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
14         end
15       end
16       @objects.each do |vm|
17         vm.current_user_logins = @vm_logins[vm.uuid].andand.compact || []
18       end
19     end
20     super
21   end
22
23   def webshell
24     return render_not_found if not Rails.configuration.shell_in_a_box_url
25     @webshell_url = Rails.configuration.shell_in_a_box_url % {
26       uuid: @object.uuid,
27       hostname: @object.hostname,
28     }
29     render layout: false
30   end
31
32 end