20259: Add documentation for banner and tooltip features
[arvados.git] / apps / workbench / app / models / link.rb
index 5e7b42a60b0ea985dcda2daf6822d8dcb22c1dec..920b4bdcc561f542fe465369333a6c62b89098f4 100644 (file)
@@ -1,7 +1,29 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class Link < ArvadosBase
   attr_accessor :head
   attr_accessor :tail
   def self.by_tail(t, opts={})
     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