Class: MHV::AuditLoginJob

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/sidekiq/mhv/audit_login_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(uuid) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/sidekiq/mhv/audit_login_job.rb', line 9

def perform(uuid)
  user = User.find(uuid)

  return if user.mhv_last_signed_in

  MHVLogging::Client.new(session: { user_id: user.mhv_correlation_id })
                    .authenticate
                    .auditlogin

  # Update the user object with the time of login
  user.mhv_last_signed_in = Time.current
  user.save
end