21128: Merge commit 'adbbc9e3c7a36d39b30f403555ee5889e32adcc0' into 21128-toolbar...
[arvados.git] / services / api / app / models / virtual_machine.rb
index 43f3c44839dfa8b225b03a54e0e717523909a7ca..09687385cad88b29c4a388e713d805a67003de2d 100644 (file)
@@ -1,9 +1,19 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class VirtualMachine < ArvadosModel
-  include AssignUuid
+  include HasUuid
   include KindAndEtag
   include CommonApiTemplate
 
-  api_accessible :superuser, :extend => :common do |t|
+  has_many(:login_permissions,
+           -> { where("link_class = 'permission' and name = 'can_login'") },
+           foreign_key: 'head_uuid',
+           class_name: 'Link',
+           primary_key: 'uuid')
+
+  api_accessible :user, extend: :common do |t|
     t.add :hostname
   end