Class: Masks::Credentials::Masquerade

Inherits:
Masks::Credential show all
Defined in:
app/models/masks/credentials/masquerade.rb

Overview

Checks for an :actor to masquerade as.

Instance Method Summary collapse

Methods inherited from Masks::Credential

#backup, #backup!, #check, checks, #cleanup, #cleanup!, #mask!, #name, #patch_params, #slug

Instance Method Details

#lookupObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/masks/credentials/masquerade.rb', line 9

def lookup
  return if session.actor

  value = session.data[:as]

  @loaded =
    case value
    when Masks::ANON
      Actors::Anonymous.new(session:) if session.mask&.allow_anonymous?
    when session.mask.actor_scope
      value
    when ValidateEmail.valid?(value)
      config.find_actor(session, email: value)
    when String
      config.find_actor(session, nickname: prefix_nickname(value))
    end
end

#maskupObject



27
28
29
# File 'app/models/masks/credentials/masquerade.rb', line 27

def maskup
  approve! if @loaded
end