Sha256: a0ff7c34a2b6242cefe8c7dc28e962ff370ae73b21e2dd48a22e3d534d714002

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Decidim
  module DirectVerifications
    module Verification
      module Admin
        class AuthorizationsController < 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.2.1 app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb
decidim-direct_verifications-1.2 app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb