Class: Decidim::Admin::UpdateComponentPermissions
- Defined in:
- decidim-admin/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 Method Summary collapse
-
#call ⇒ Object
Public: Sets the permissions for a component.
-
#initialize(form, component, resource) ⇒ UpdateComponentPermissions
constructor
Public: Initializes the command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, component, resource) ⇒ UpdateComponentPermissions
Public: Initializes the command.
form - The form from which the data in this component comes from. component - The component to update. resource - The resource to update.
14 15 16 17 18 |
# File 'decidim-admin/app/commands/decidim/admin/update_component_permissions.rb', line 14 def initialize(form, component, resource) @form = form @component = component @resource = resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Public: Sets the permissions for a component.
Broadcasts :ok if created, :invalid otherwise.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'decidim-admin/app/commands/decidim/admin/update_component_permissions.rb', line 23 def call return broadcast(:invalid) unless form.valid? Decidim.traceability.perform_action!("update_permissions", @component, current_user) do transaction do run_hooks end end broadcast(:ok) end |