11454: When adding a uuid prefix on the add session box, append
[arvados.git] / apps / workbench / app / models / link.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class Link < ArvadosBase
6   attr_accessor :head
7   attr_accessor :tail
8   def self.by_tail(t, opts={})
9     where(opts.merge :tail_uuid => t.uuid)
10   end
11
12   def default_name
13     self.class.resource_class_for_uuid(head_uuid).default_name rescue super
14   end
15
16   def self.permissions_for(thing)
17     if thing.respond_to? :uuid
18       uuid = thing.uuid
19     else
20       uuid = thing
21     end
22     result = arvados_api_client.api("permissions", "/#{uuid}")
23     arvados_api_client.unpack_api_response(result)
24   end
25
26   def self.creatable?
27     false
28   end
29 end