X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7cd190acfc0b6ce7f65b3effa1e2ce75ed692a3d..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 29379a03ce..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? @@ -357,6 +357,14 @@ class ArvadosBase < ActiveRecord::Base (ArvadosBase.find(owner_uuid).writable_by.include? current_user.uuid rescue false)))) or false end + def deletable? + 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