Sha256: 3adbebb5f8a5b932f9121efbef6671e3f49740b1848f37753e4fc5becc43af7e

Contents?: true

Size: 683 Bytes

Versions: 11

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # 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.
    class ImpersonateManagedUserForm < Form
      def initialize(attributes)
        extend(Virtus.model)

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

        super
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-admin-0.10.1 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.10.0 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.9.3 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.9.2 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.9.1 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.9.0 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.8.4 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.8.3 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.8.2 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.8.1 app/forms/decidim/admin/impersonate_managed_user_form.rb
decidim-admin-0.8.0 app/forms/decidim/admin/impersonate_managed_user_form.rb