Class: Decidim::Admin::UpdateComponentPermissions
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Admin::UpdateComponentPermissions
- Defined in:
- app/commands/decidim/admin/update_component_permissions.rb
Overview
This command gets called when permissions for a component are updated in the admin panel.
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Sets the permissions for a component.
-
#initialize(form, component) ⇒ UpdateComponentPermissions
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, component) ⇒ UpdateComponentPermissions
Public: Initializes the command.
form - The form from which the data in this component comes from. component - The component to update.
14 15 16 17 |
# File 'app/commands/decidim/admin/update_component_permissions.rb', line 14 def initialize(form, component) @form = form @component = component end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
8 9 10 |
# File 'app/commands/decidim/admin/update_component_permissions.rb', line 8 def component @component end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
8 9 10 |
# File 'app/commands/decidim/admin/update_component_permissions.rb', line 8 def form @form end |
Instance Method Details
#call ⇒ Object
Public: Sets the permissions for a component.
Broadcasts :ok if created, :invalid otherwise.
22 23 24 25 26 27 28 29 30 31 |
# File 'app/commands/decidim/admin/update_component_permissions.rb', line 22 def call return broadcast(:invalid) unless @form.valid? transaction do run_hooks end broadcast(:ok) end |