Class: Decidim::Kids::CloseSessionManagedMinor

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/kids/close_session_managed_minor.rb

Overview

A command with all the business logic to close a current impersonation session.

Instance Method Summary collapse

Constructor Details

#initialize(current_user, real_user) ⇒ CloseSessionManagedMinor

Public: Initializes the command.

real_user - The user impersonating a minor current_user - The user to impersonate



11
12
13
14
# File 'app/commands/decidim/kids/close_session_managed_minor.rb', line 11

def initialize(current_user, real_user)
  @real_user = real_user
  @current_user = current_user
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
# File 'app/commands/decidim/kids/close_session_managed_minor.rb', line 16

def call
  return broadcast(:invalid) if impersonation_log.blank?

  close_session

  broadcast(:ok)
end