Sha256: bd9594628e0aed8a94f21a126bf7a2c6ca21c35152f83a08616bb769c143a4b5

Contents?: true

Size: 994 Bytes

Versions: 31

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class FreeResourceAuthorizationModalsController < Decidim::ApplicationController
    helper_method :authorizations, :authorize_action_path
    layout false

    def show
      render template: "decidim/authorization_modals/show"
    end

    private

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

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

    def authorize_action_path(handler_name)
      authorizations.status_for(handler_name).current_path(redirect_url: URI(request.referer).path)
    end

    def authorizations
      @authorizations ||= action_authorized_to(authorization_action, resource: nil, permissions_holder: resource)
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.8 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.7 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.6 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.10 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.9 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.5 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.8 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.4 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.3 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.7 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.5 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.2 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.1 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.4 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.0 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.3 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.0.rc2 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.27.0.rc1 app/controllers/decidim/free_resource_authorization_modals_controller.rb
decidim-core-0.26.2 app/controllers/decidim/free_resource_authorization_modals_controller.rb