X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b441daaf99f0596170a083d798ba3276f3dbe565..e1491e3edb997dc6683acd1ebf1c1a95d09d4298:/services/api/app/models/container.rb diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index 619abcc86e..376be55ffb 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -368,7 +368,7 @@ class Container < ArvadosModel def check_unlock if state_was == Locked and state == Queued if self.locked_by_uuid != current_api_client_authorization.uuid - raise InvalidStateTransitionError.new("locked by a different token") + raise ArvadosModel::PermissionDeniedError.new("locked by a different token") end if self.lock_count >= Rails.configuration.Containers.MaxDispatchAttempts self.state = Cancelled @@ -423,6 +423,10 @@ class Container < ArvadosModel current_user.andand.is_admin end + def permission_to_destroy + current_user.andand.is_admin + end + def ensure_owner_uuid_is_permitted # validate_change ensures owner_uuid can't be changed at all -- # except during create, which requires admin privileges. Checking