Module: CanTango::Ability::MasqueradeHelpers

Included in:
CanTango::Ability
Defined in:
lib/cantango/ability/masquerade_helpers.rb

Instance Method Summary collapse

Instance Method Details

#masquerade_account?Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/cantango/ability/masquerade_helpers.rb', line 14

def masquerade_account?
  return false if masquerading_off?
  candidate.respond_to?(:active_account)
end

#masquerade_user?Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/cantango/ability/masquerade_helpers.rb', line 5

def masquerade_user?
  return false if masquerading_off?
  candidate.respond_to?(:active_user) && masquerading?
end

#masquerading?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cantango/ability/masquerade_helpers.rb', line 10

def masquerading?
  candidate.respond_to?(:masquerading?) && candidate.masquerading?
end

#masquerading_off?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cantango/ability/masquerade_helpers.rb', line 19

def masquerading_off?
  options[:masquerade] == false
end