Module: CanTango::Ability::Helper::Masquerade
- Included in:
- Scope::Ability
- Defined in:
- lib/cantango/masquerade/ability/helper/masquerade.rb
Instance Method Summary collapse
- #masquerade_account? ⇒ Boolean
- #masquerade_user? ⇒ Boolean
- #masquerading? ⇒ Boolean (also: #masquerade?)
- #masquerading_off? ⇒ Boolean (also: #masquerade_off?)
- #subject ⇒ Object
Instance Method Details
#masquerade_account? ⇒ Boolean
13 14 15 |
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 13 def masquerade_account? candidate.respond_to?(:active_account) && masquerading? && !masquerading_off? end |
#masquerade_user? ⇒ Boolean
9 10 11 |
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 9 def masquerade_user? candidate.respond_to?(:active_user) && masquerading? && !masquerading_off? end |
#masquerading? ⇒ Boolean Also known as: masquerade?
4 5 6 |
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 4 def masquerading? candidate.respond_to?(:masquerading?) && candidate.masquerading? && !masquerading_off? end |
#masquerading_off? ⇒ Boolean Also known as: masquerade_off?
17 18 19 |
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 17 def masquerading_off? [:masquerade] == false end |
#subject ⇒ Object
22 23 24 25 26 |
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 22 def subject return candidate.active_user if masquerade_user? return candidate.active_account if masquerade_account? candidate end |