Sha256: e0e52ca7fb3a6564a2948b83fbd2ef0cdfd122d1bc37c28592e83de564b1def7

Contents?: true

Size: 1.05 KB

Versions: 21

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Decidim
  module Verifications
    module IdDocuments
      module Admin
        class PendingAuthorizationsController < Decidim::Admin::ApplicationController
          layout "decidim/admin/users"

          helper_method :has_offline_method?

          def index
            enforce_permission_to :index, :authorization

            @pending_online_authorizations = pending_online_authorizations
          end

          private

          def pending_online_authorizations
            Authorizations
              .new(organization: current_organization, name: "id_documents", granted: false)
              .query
              .where("verification_metadata->'rejected' IS NULL")
              .where("verification_metadata->>'verification_type' = 'online'")
          end

          def has_offline_method?
            available_methods.include?("offline")
          end

          def available_methods
            @available_methods ||= current_organization.id_documents_methods
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-verifications-0.16.0 app/controllers/decidim/verifications/id_documents/admin/pending_authorizations_controller.rb