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-5.0.0.pre app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.2.3 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.2.2 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.2.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.2.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.0.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-4.0.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.1.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.1.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.7 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.6 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.5 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.4 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.3 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.2 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-3.0.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-2.2.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-2.2.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-2.1.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb