Class: Gitlab::SidekiqMiddleware::AdminMode::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/sidekiq_middleware/admin_mode/server.rb

Instance Method Summary collapse

Instance Method Details

#call(_worker, job, _queue) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/sidekiq_middleware/admin_mode/server.rb', line 7

def call(_worker, job, _queue)
  return yield unless Feature.enabled?(:user_mode_in_session)

  admin_mode_user_id = job['admin_mode_user_id']

  # Do not bypass session if this job was not enabled with admin mode on
  return yield unless admin_mode_user_id

  Gitlab::Auth::CurrentUserMode.bypass_session!(admin_mode_user_id) do
    Gitlab::AppLogger.debug("AdminMode::Server bypasses session for admin mode in job: #{job.inspect}")

    yield
  end
end