Module: CanTango::Ability::Helper::Masquerade

Included in:
Scope::Ability
Defined in:
lib/cantango/masquerade/ability/helper/masquerade.rb

Instance Method Summary collapse

Instance Method Details

#masquerade_account?Boolean

Returns:

  • (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

Returns:

  • (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?

Returns:

  • (Boolean)


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?

Returns:

  • (Boolean)


17
18
19
# File 'lib/cantango/masquerade/ability/helper/masquerade.rb', line 17

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

#subjectObject



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. if masquerade_account?
  candidate
end