Class: Decidim::Verifications::RevokeAuthorizationsByCondition
- Inherits:
-
Command
- Object
- Command
- Decidim::Verifications::RevokeAuthorizationsByCondition
- Defined in:
- app/commands/decidim/verifications/revoke_authorizations_by_condition.rb
Overview
A command to revoke authorizations with filter
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(organization, form) ⇒ RevokeAuthorizationsByCondition
constructor
Initializes the command.
Constructor Details
#initialize(organization, form) ⇒ RevokeAuthorizationsByCondition
Initializes the command.
12 13 14 15 |
# File 'app/commands/decidim/verifications/revoke_authorizations_by_condition.rb', line 12 def initialize(organization, form) @organization = organization @form = form end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the handler was not valid and we could not proceed.
Returns nothing.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/commands/decidim/verifications/revoke_authorizations_by_condition.rb', line 23 def call return broadcast(:invalid) unless @organization return broadcast(:invalid) unless @form.valid? if @form.before_date.present? RevokeAuthorizationsByConditionJob.perform_later( organization, current_user, @form.before_date, @form.impersonated_only? ) broadcast(:ok) else broadcast(:invalid) end end |