Class: Decidim::Verifications::IdDocuments::Admin::ConfirmationsController

Inherits:
Admin::ApplicationController show all
Defined in:
decidim-verifications/app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb

Overview

Handles confirmations for verification by identity document upload.

Instance Method Summary collapse

Methods inherited from Admin::ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#createObject


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'decidim-verifications/app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb', line 21

def create
  enforce_permission_to :update, :authorization, authorization: @pending_authorization

  @form = InformationForm.from_params(params)

  ConfirmUserAuthorization.call(@pending_authorization, @form, session) do
    on(:ok) do
      flash[:notice] = t("confirmations.create.success", scope: "decidim.verifications.id_documents.admin")
      redirect_to pending_authorizations_path
    end

    on(:invalid) do
      flash.now[:alert] = t("confirmations.create.error", scope: "decidim.verifications.id_documents.admin")
      render action: :new
    end
  end
end

#newObject


15
16
17
18
19
# File 'decidim-verifications/app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb', line 15

def new
  enforce_permission_to :update, :authorization, authorization: @pending_authorization

  @form = InformationForm.new
end