Sha256: 8be2a98f72b05767b0586836717f153387ac34a011c8c4503c6e59ab091a27e8

Contents?: true

Size: 440 Bytes

Versions: 46

Compression:

Stored size: 440 Bytes

Contents

module Controller
  module PunditNamespacedAuthorizeConcern
    extend ActiveSupport::Concern

    included do
      helper_method :engine_policy
    end

    def authorize(policy, action, namespace = nil)
      policy = "#{namespace}::#{policy.to_s.camelize}".to_sym if namespace.present?
      super(policy, action)
    end

    def engine_policy(engine)
      policy_name = engine.name.to_sym
      policy(policy_name)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
itsf_backend-1.1.4 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.3 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.2 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.0.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb