Merge branch '4621-crunch-memory-usage'
[arvados.git] / apps / workbench / app / models / link.rb
1 class Link < ArvadosBase
2   attr_accessor :head
3   attr_accessor :tail
4   def self.by_tail(t, opts={})
5     where(opts.merge :tail_uuid => t.uuid)
6   end
7
8   def default_name
9     self.class.resource_class_for_uuid(head_uuid).default_name rescue super
10   end
11
12   def self.permissions_for(thing)
13     if thing.respond_to? :uuid
14       uuid = thing.uuid
15     else
16       uuid = thing
17     end
18     result = arvados_api_client.api("permissions", "/#{uuid}")
19     arvados_api_client.unpack_api_response(result)
20   end
21 end