X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/522404b2066c8b635a240f79dd4bf652479afadb..007d2919fc56632bc957d90378ed7a5d3b14aa3c:/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..5d6a4c94b9 100644 --- a/apps/workbench/app/models/arvados_base.rb +++ b/apps/workbench/app/models/arvados_base.rb @@ -144,6 +144,10 @@ class ArvadosBase < ActiveRecord::Base ArvadosResourceList.new(self).select(*args) end + def self.with_count(*args) + ArvadosResourceList.new(self).with_count(*args) + end + def self.distinct(*args) ArvadosResourceList.new(self).distinct(*args) end @@ -334,7 +338,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 +365,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