X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/934694fb672f0768ec61701009a4eb2e149d6431..7e54f217895d2f401563c54704c73a196e2d236d:/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 f89e9f4059..672374bc6c 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -42,13 +42,13 @@ class ArvadosModel < ActiveRecord::Base class AlreadyLockedError < StandardError def http_status - 403 + 422 end end class InvalidStateTransitionError < StandardError def http_status - 403 + 422 end end @@ -271,6 +271,18 @@ class ArvadosModel < ActiveRecord::Base protected + def self.deep_sort_hash(x) + if x.is_a? Hash + x.sort.collect do |k, v| + [k, deep_sort_hash(v)] + end.to_h + elsif x.is_a? Array + x.collect { |v| deep_sort_hash(v) } + else + x + end + end + def ensure_ownership_path_leads_to_user if new_record? or owner_uuid_changed? uuid_in_path = {owner_uuid => true, uuid => true} @@ -518,7 +530,7 @@ class ArvadosModel < ActiveRecord::Base end def self.uuid_like_pattern - "_____-#{uuid_prefix}-_______________" + "#{Rails.configuration.uuid_prefix}-#{uuid_prefix}-_______________" end def self.uuid_regex