Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / services / api / app / models / virtual_machine.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class VirtualMachine < ArvadosModel
6   include HasUuid
7   include KindAndEtag
8   include CommonApiTemplate
9
10   has_many(:login_permissions,
11            -> { where("link_class = 'permission' and name = 'can_login'") },
12            foreign_key: :head_uuid,
13            class_name: 'Link',
14            primary_key: :uuid)
15
16   api_accessible :user, extend: :common do |t|
17     t.add :hostname
18   end
19
20   protected
21
22   def permission_to_create
23     current_user and current_user.is_admin
24   end
25   def permission_to_update
26     current_user and current_user.is_admin
27   end
28 end