X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9456885954b0bff02721bbb14da296be212efdc4..8ae04f9f4d252a99985d7ac047413318d2f1068b:/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 89f9a8886e..ea69735502 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'has_uuid' require 'record_filters' require 'serializers' @@ -46,6 +50,12 @@ class ArvadosModel < ActiveRecord::Base end end + class LockFailedError < StandardError + def http_status + 422 + end + end + class InvalidStateTransitionError < StandardError def http_status 422 @@ -98,6 +108,12 @@ class ArvadosModel < ActiveRecord::Base super(self.class.permit_attribute_params(raw_params), *args) end + # Reload "old attributes" for logging, too. + def reload(*args) + super + log_start_state + end + def self.create raw_params={}, *args super(permit_attribute_params(raw_params), *args) end @@ -238,7 +254,8 @@ class ArvadosModel < ActiveRecord::Base # Check if any of the users are admin. If so, we're done. if users_list.select { |u| u.is_admin }.any? - return self + # Return existing relation with no new filters. + return where({}) end # Collect the UUIDs of the authorized users.