Merge branch 'master' of git.curoverse.com:arvados into 2659-anonymous-share-projects
[arvados.git] / apps / workbench / app / models / virtual_machine.rb
1 class VirtualMachine < ArvadosBase
2   attr_accessor :current_user_logins
3   def self.creatable?
4     current_user.andand.is_admin
5   end
6   def attributes_for_display
7     super.append ['current_user_logins', @current_user_logins]
8   end
9   def editable_attributes
10     super - %w(current_user_logins)
11   end
12   def self.attribute_info
13     merger = ->(k,a,b) { a.merge(b, &merger) }
14     merger [nil,
15             {current_user_logins: {column_heading: "logins", type: 'array'}},
16             super]
17   end
18   def friendly_link_name lookup=nil
19     (hostname && !hostname.empty?) ? hostname : uuid
20   end
21 end