Class: Decidim::Admin::ComponentPermissionsController
- Inherits:
-
ResourcePermissionsController
- Object
- DecidimController
- ApplicationController
- ResourcePermissionsController
- Decidim::Admin::ComponentPermissionsController
- Includes:
- ComponentPathHelper
- Defined in:
- app/controllers/decidim/admin/component_permissions_controller.rb
Overview
Controller that allows managing component and related resources permissions.
Instance Method Summary collapse
Methods inherited from ApplicationController
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#edit ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/decidim/admin/component_permissions_controller.rb', line 10 def edit (:update, :component, component:) @permissions_form = PermissionsForm.new( permissions: ) render template: "decidim/admin/resource_permissions/edit" end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/decidim/admin/component_permissions_controller.rb', line 19 def update (:update, :component, component:) @permissions_form = PermissionsForm.from_params(params) UpdateComponentPermissions.call(@permissions_form, component, resource) do on(:ok) do flash[:notice] = t("component_permissions.update.success", scope: "decidim.admin") redirect_to return_path end on(:invalid) do flash.now[:alert] = t("component_permissions.update.error", scope: "decidim.admin") render action: :edit end end end |