[ARVADOS] created: 2ee3d94756197297876afb64b7d5bc2789419aaf

Git user git at public.curoverse.com
Thu Oct 20 05:39:09 EDT 2016


        at  2ee3d94756197297876afb64b7d5bc2789419aaf (commit)


commit 2ee3d94756197297876afb64b7d5bc2789419aaf
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 20 05:37:25 2016 -0400

    10310: Check discovery doc when deciding ArvadosBase.creatable?.

diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index b02db7a..6250daa 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -334,7 +334,7 @@ class ArvadosBase < ActiveRecord::Base
   end
 
   def self.creatable?
-    current_user.andand.is_active
+    current_user.andand.is_active && api_exists?(:create)
   end
 
   def self.goes_in_projects?
@@ -361,6 +361,10 @@ class ArvadosBase < ActiveRecord::Base
     editable?
   end
 
+  def self.api_exists?(method)
+    arvados_api_client.discovery[:resources][self.to_s.underscore.pluralize.to_sym].andand[:methods].andand[method]
+  end
+
   # Array of strings that are the names of attributes that can be edited
   # with X-Editable.
   def editable_attributes

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list