X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a1c4ece152e1e992c18f0cb368528cd2ac843b07..d89876219e668a3a97a6c61f92320bad0c0527c8:/services/api/app/models/arvados_model.rb?ds=sidebyside diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb index 91c5a1923c..816dbf4758 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -409,8 +409,20 @@ class ArvadosModel < ApplicationRecord end end + def user_owner_uuid + if self.owner_uuid.nil? + return current_user.uuid + end + owner_class = ArvadosModel.resource_class_for_uuid(self.owner_uuid) + if owner_class == User + self.owner_uuid + else + owner_class.find_by_uuid(self.owner_uuid).user_owner_uuid + end + end + def logged_attributes - attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes) + attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes.keys) end def self.full_text_searchable_columns @@ -445,6 +457,9 @@ class ArvadosModel < ApplicationRecord if not ft[:cond_out].any? return query end + ft[:joins].each do |t| + query = query.joins(t) + end query.where('(' + ft[:cond_out].join(') AND (') + ')', *ft[:param_out]) end @@ -723,6 +738,14 @@ class ArvadosModel < ApplicationRecord end end + def ensure_filesystem_compatible_name + if name == "." || name == ".." + errors.add(:name, "cannot be '.' or '..'") + elsif Rails.configuration.Collections.ForwardSlashNameSubstitution == "" && !name.nil? && name.index('/') + errors.add(:name, "cannot contain a '/' character") + end + end + class Email def self.kind "email"