X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9707b0c9304596799d01cf5c2d1d630026a49d79..fc8e572937f2fd61bdc1e7f34a2e3f9a5cebd7ff:/services/api/app/models/arvados_model.rb diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb index 308da7fa11..5f9c014bbd 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -56,6 +56,12 @@ class ArvadosModel < ActiveRecord::Base "#{current_api_base}/#{self.class.to_s.pluralize.underscore}/#{self.uuid}" end + def self.selectable_attributes(template=:user) + # Return an array of attribute name strings that can be selected + # in the given template. + api_accessible_attributes(template).map { |attr_spec| attr_spec.first.to_s } + end + def self.searchable_columns operator textonly_operator = !operator.match(/[<=>]/) self.columns.select do |col| @@ -107,6 +113,7 @@ class ArvadosModel < ActiveRecord::Base # If current user cannot write this object, just return # [self.owner_uuid]. def writable_by + return [owner_uuid] if not current_user unless (owner_uuid == current_user.uuid or current_user.is_admin or (current_user.groups_i_can(:manage) & [uuid, owner_uuid]).any?)