Sha256: 99ac075c39d84887f293a3893e6b56dc79f88c9168efe66f9f6d98802b75dfa7

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Decidim
  module DirectVerifications
    module Verification
      module Admin
        class AuthorizationsController < Decidim::Admin::ApplicationController
          layout "decidim/admin/users"

          def index
            enforce_permission_to :index, :authorization
            @authorizations = collection.includes(:user)
                                        .page(params[:page])
                                        .per(15)
          end

          def destroy
            if authorization.destroy
              flash[:notice] = "successfully"
              redirect_to authorizations_path
            end
          end

          private

          def collection
            # Decidim::Verifications::Authorizations Query
            Decidim::Verifications::Authorizations.new(
              organization: current_organization,
              name: "direct_verifications",
              granted: true
            ).query
          end

          def authorization
            @authorization ||= collection.find_by(id: params[:id])
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-direct_verifications-1.0.2 app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb
decidim-direct_verifications-1.1 app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb