Class: Decidim::ImpersonationLog
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::ImpersonationLog
- Defined in:
- app/models/decidim/impersonation_log.rb
Overview
ImpersonationLogs are created whenever an admin impersonate a managed user
Constant Summary collapse
- SESSION_TIME_IN_MINUTES =
30
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
24 25 26 |
# File 'app/models/decidim/impersonation_log.rb', line 24 def self.log_presenter_class_for(_log) Decidim::AdminLog::ImpersonationLogPresenter end |
Instance Method Details
#ended? ⇒ Boolean
16 17 18 |
# File 'app/models/decidim/impersonation_log.rb', line 16 def ended? ended_at.present? end |
#ensure_not_expired! ⇒ Object
28 29 30 |
# File 'app/models/decidim/impersonation_log.rb', line 28 def ensure_not_expired! expire! if started_at + SESSION_TIME_IN_MINUTES.minutes < Time.current end |
#expire! ⇒ Object
32 33 34 |
# File 'app/models/decidim/impersonation_log.rb', line 32 def expire! update!(expired_at: Time.current) end |
#expired? ⇒ Boolean
20 21 22 |
# File 'app/models/decidim/impersonation_log.rb', line 20 def expired? expired_at.present? end |