14196: Don't crash if element of params[:reader_tokens] is not a String
[arvados.git] / services / api / lib / arvados_model_updates.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 module ArvadosModelUpdates
6   # ArvadosModel checks this to decide whether it should update the
7   # 'modified_by_user_uuid' field.
8   def anonymous_updater
9     Thread.current[:anonymous_updater] || false
10   end
11
12   def leave_modified_by_user_alone
13     anonymous_updater_was = anonymous_updater
14     begin
15       Thread.current[:anonymous_updater] = true
16       yield
17     ensure
18       Thread.current[:anonymous_updater] = anonymous_updater_was
19     end
20   end
21 end