Class: Decidim::Admin::ImpersonateManagedUserForm

Inherits:
Form
  • Object
show all
Defined in:
decidim-admin/app/forms/decidim/admin/impersonate_managed_user_form.rb

Overview

A form object used to impersonate managed users from the admin dashboard.

This form will contain a dynamic attribute for the user authorization. This authorization will be selected by the admin user if more than one exists.

Instance Method Summary collapse

Methods inherited from Form

#available_locales

Constructor Details

#initialize(attributes) ⇒ ImpersonateManagedUserForm

Returns a new instance of ImpersonateManagedUserForm.



10
11
12
13
14
15
16
17
# File 'decidim-admin/app/forms/decidim/admin/impersonate_managed_user_form.rb', line 10

def initialize(attributes)
  extend(Virtus.model)

  # Set the authorization dynamic attribute as a nested form class based on the handler name.
  attribute(:authorization, attributes.dig(:authorization, :handler_name).classify.constantize)

  super
end