Merge branch 'master' into 3889-functional-testing
[arvados.git] / apps / workbench / app / models / virtual_machine.rb
index 61b3b6b36173703a8a554b9e4083773dc0015788..978964196d412b76f993e46b717a7977ea773ecc 100644 (file)
@@ -1,5 +1,21 @@
 class VirtualMachine < ArvadosBase
+  attr_accessor :current_user_logins
   def self.creatable?
     current_user.andand.is_admin
   end
+  def attributes_for_display
+    super.append ['current_user_logins', @current_user_logins]
+  end
+  def attribute_editable? attr, *args
+    attr != 'current_user_logins' and super
+  end
+  def self.attribute_info
+    merger = ->(k,a,b) { a.merge(b, &merger) }
+    merger [nil,
+            {current_user_logins: {column_heading: "logins", type: 'array'}},
+            super]
+  end
+  def friendly_link_name
+    (hostname && !hostname.empty?) ? hostname : uuid
+  end
 end