show cli update example on generic object#get page
[arvados.git] / apps / workbench / app / models / arvados_base.rb
index baceae968540a8da20fa6c9dc0ee580a85ef0d6e..267a4a9133ef1c9b5c05372488faa349d0ae332e 100644 (file)
@@ -204,6 +204,10 @@ class ArvadosBase < ActiveRecord::Base
     }
   end
 
+  def self.creatable?
+    current_user
+  end
+
   def editable?
     (current_user and
      (current_user.is_admin or
@@ -216,7 +220,7 @@ class ArvadosBase < ActiveRecord::Base
     elsif "uuid owner".index(attr.to_s)
       current_user and current_user.is_admin
     else
-      true
+      current_user and current_user.uuid == owner
     end
   end
 
@@ -257,7 +261,11 @@ class ArvadosBase < ActiveRecord::Base
     self
   end
 
-  def current_user
+  def self.current_user
+    Thread.current[:user] ||= User.current if Thread.current[:arvados_api_token]
     Thread.current[:user]
   end
+  def current_user
+    self.class.current_user
+  end
 end