Class: Decidim::Kids::MinorImpersonationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Decidim::Kids::MinorImpersonationsController
- Includes:
- UserProfile
- Defined in:
- app/controllers/decidim/kids/minor_impersonations_controller.rb
Overview
Controller that allows impersonating managed minors.
Instance Method Summary collapse
Instance Method Details
#close_session ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'app/controllers/decidim/kids/minor_impersonations_controller.rb', line 41 def close_session CloseSessionManagedMinor.call(current_user, real_user) do on(:ok) do flash[:notice] = I18n.t("impersonations.close_session.success", scope: "decidim.kids") redirect_to decidim.root_path end end end |
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/decidim/kids/minor_impersonations_controller.rb', line 23 def create :impersonate, :minor_accounts, minor_user: minor_user @form = form(ImpersonateMinorForm).from_params(params) ImpersonateMinor.call(minor_user, current_user, @form) do on(:ok) do flash[:notice] = I18n.t("impersonations.create.success", scope: "decidim.kids") redirect_to decidim.root_path end on(:invalid) do flash.now[:alert] = I18n.t("impersonations.create.error", scope: "decidim.kids") render :new end end end |
#new ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/decidim/kids/minor_impersonations_controller.rb', line 17 def new :impersonate, :minor_accounts, minor_user: minor_user @form = form(ImpersonateMinorForm).from_params(params) end |
#permission_class_chain ⇒ Object
13 14 15 |
# File 'app/controllers/decidim/kids/minor_impersonations_controller.rb', line 13 def [::Decidim::Kids::Permissions] + super end |