Class: Decidim::Admin::TransferUser
- Inherits:
-
Command
- Object
- Command
- Decidim::Admin::TransferUser
- Defined in:
- app/commands/decidim/admin/transfer_user.rb
Overview
A command with all the business logic to transfer a managed user.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form) ⇒ TransferUser
constructor
Public: Initializes the command.
Constructor Details
#initialize(form) ⇒ TransferUser
Public: Initializes the command.
form user - The current user managed_user - The managed User
12 13 14 |
# File 'app/commands/decidim/admin/transfer_user.rb', line 12 def initialize(form) @form = form end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the impersonation is not valid.
Returns nothing.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/commands/decidim/admin/transfer_user.rb', line 22 def call return broadcast(:invalid) unless form.valid? transaction do update_managed_user mark_conflict_as_solved create_action_log end broadcast(:ok) end |