Class: Booth::Userland::Sessions::Transitions::Show::EnterWebauth

Inherits:
Object
  • Object
show all
Includes:
Concerns::Transition
Defined in:
lib/booth/userland/sessions/transitions/show/enter_webauth.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.applicable?(params:) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/booth/userland/sessions/transitions/show/enter_webauth.rb', line 9

def self.applicable?(params:)
  !params[:webauth]
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/booth/userland/sessions/transitions/show/enter_webauth.rb', line 13

def call
  if sudo.webauth?
    if session_id_param
      debug { 'Having webauth sudo, revoking the desired session...' }
      return ::Booth::Sessions::Revoke.call credential_id: authentication.credential_id,
                                            session_id: session_id_param
    else
      debug { 'Having webauth sudo, revoking all other sessions...' }
      return ::Booth::Sessions::RevokeAllOthers.call credential_id: authentication.credential_id,
                                                     surviving_session_id: authentication.session_id
    end
  end

  if session_id_param
    Tron.failure :need_sudo_to_show_session,
                 step: :enter_webauth_to_show,
                 session_id: session_id_param
  else
    Tron.failure :need_sudo_to_show_all_other_sessions,
                 step: :enter_webauth_to_show_all_others
  end
end