Class: Decidim::Kids::ImpersonationMinorLog

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/kids/impersonation_minor_log.rb

Overview

ImpersonationLogs are created whenever an tutor impersonate a minor user

Constant Summary collapse

SESSION_TIME_IN_MINUTES =
10

Instance Method Summary collapse

Instance Method Details

#ended?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/decidim/kids/impersonation_minor_log.rb', line 19

def ended?
  ended_at.present?
end

#ensure_not_expired!Object



27
28
29
# File 'app/models/decidim/kids/impersonation_minor_log.rb', line 27

def ensure_not_expired!
  expire! if started_at + SESSION_TIME_IN_MINUTES.minutes < Time.current
end

#expire!Object



31
32
33
# File 'app/models/decidim/kids/impersonation_minor_log.rb', line 31

def expire!
  update!(expired_at: Time.current)
end

#expired?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/decidim/kids/impersonation_minor_log.rb', line 23

def expired?
  expired_at.present?
end