Module: CanTango::Users::Masquerade
- Included in:
- UserAccount
- Defined in:
- lib/cantango/users/masquerade.rb,
lib/cantango/users/masquerade/session_active_user.rb
Defined Under Namespace
Modules: SessionActiveUser
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#masquerading ⇒ Object
Returns the value of attribute masquerading.
5
6
7
|
# File 'lib/cantango/users/masquerade.rb', line 5
def masquerading
@masquerading
end
|
Instance Method Details
#masquerade_as(user) ⇒ Object
7
8
9
10
11
|
# File 'lib/cantango/users/masquerade.rb', line 7
def masquerade_as user
@masquerading = true
user = user.kind_of?(String) ? ::User.find(user) : user
@active_user = user
end
|
#masquerading? ⇒ Boolean
17
18
19
|
# File 'lib/cantango/users/masquerade.rb', line 17
def masquerading?
!@masquerading.nil?
end
|
#stop_masquerade ⇒ Object
13
14
15
|
# File 'lib/cantango/users/masquerade.rb', line 13
def stop_masquerade
@active_user, @masquerading = nil, nil
end
|