Module: MrMime::ImpersonationBehavior

Included in:
ApplicationController
Defined in:
app/controllers/mr_mime/impersonation_behavior.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'app/controllers/mr_mime/impersonation_behavior.rb', line 3

def self.included(base)
  base.helper_method :current_impersonator, :impersonator?, :impersonator_id
  base.helper MrMime::ImpersonationHelper
end

Instance Method Details

#current_impersonatorObject



8
9
10
# File 'app/controllers/mr_mime/impersonation_behavior.rb', line 8

def current_impersonator
  MrMime::Config.user_class.find_by(id: impersonator_id) if impersonator?
end

#impersonator?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/controllers/mr_mime/impersonation_behavior.rb', line 12

def impersonator?
  impersonator_id.present?
end

#impersonator_idObject



16
17
18
# File 'app/controllers/mr_mime/impersonation_behavior.rb', line 16

def impersonator_id
  session['mr_mime.impersonator_id']
end