Sha256: f3c73ecad540b68dd2b39d41512e0a302df72feaedd1a1defe1bf49448fb1dc5

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class AuthorizationModalsController < Decidim::ApplicationController
    helper_method :status, :authorize_action_path
    layout false

    def show; end

    private

    def resource
      @resource ||= if params[:resource_name] && params[:resource_id]
                      manifest = Decidim.find_resource_manifest(params[:resource_name])
                      manifest&.resource_scope(current_component)&.find_by(id: params[:resource_id])
                    end
    end

    def current_component
      @current_component ||= Decidim::Component.find(params[:component_id])
    end

    def authorization_action
      @authorization_action ||= params[:authorization_action]
    end

    def authorize_action_path
      status.current_path(redirect_url: URI(request.referer).path)
    end

    def status
      @status ||= action_authorized_to(authorization_action, resource: resource)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.16.1 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.16.0 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.15.2 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.15.1 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.15.0 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.14.4 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.14.3 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.14.2 app/controllers/decidim/authorization_modals_controller.rb
decidim-core-0.14.1 app/controllers/decidim/authorization_modals_controller.rb