Merge branch '10701-refactor-dispatch'
[arvados.git] / apps / workbench / app / models / link.rb
index 9c86e3171f778292578bc9e0dbaccd39c0890a88..b1bbcff1265ac0b545e210ab7d6621c7dce0b7a8 100644 (file)
@@ -1,7 +1,25 @@
-class Link < OrvosBase
+class Link < ArvadosBase
   attr_accessor :head
   attr_accessor :tail
   def self.by_tail(t, opts={})
-    where(opts.merge :tail_kind => t.kind, :tail_uuid => t.uuid)
+    where(opts.merge :tail_uuid => t.uuid)
+  end
+
+  def default_name
+    self.class.resource_class_for_uuid(head_uuid).default_name rescue super
+  end
+
+  def self.permissions_for(thing)
+    if thing.respond_to? :uuid
+      uuid = thing.uuid
+    else
+      uuid = thing
+    end
+    result = arvados_api_client.api("permissions", "/#{uuid}")
+    arvados_api_client.unpack_api_response(result)
+  end
+
+  def self.creatable?
+    false
   end
 end