X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/19ae770973482257117fe8ded5619c3018c4b60f..21598295f38998d8028aaa117f192de6b5758808:/apps/workbench/app/models/arvados_base.rb diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb index b02db7a6b6..6250daa06a 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