Class: Decidim::Kids::ImpersonateMinor
- Inherits:
-
Command
- Object
- Command
- Decidim::Kids::ImpersonateMinor
- Defined in:
- app/commands/decidim/kids/impersonate_minor.rb
Overview
A command with all the business logic to impersonate a minor.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(minor_user, current_user, form) ⇒ ImpersonateMinor
constructor
Public: Initializes the command.
Constructor Details
#initialize(minor_user, current_user, form) ⇒ ImpersonateMinor
Public: Initializes the command.
current_user - The user impersonating a minor minor_user - The user to impersonate form - The form with the authorization info
12 13 14 15 16 |
# File 'app/commands/decidim/kids/impersonate_minor.rb', line 12 def initialize(minor_user, current_user, form) @current_user = current_user @minor_user = minor_user @form = form end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/kids/impersonate_minor.rb', line 18 def call return broadcast(:invalid) if form.invalid? transaction do impersonation_log = create_impersonation_log create_action_log(impersonation_log) end enqueue_expire_job broadcast(:ok) end |