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-2.0.2 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-2.0.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.8 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.7 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.6 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.5 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.4 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.1 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.2.0 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.15 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.14 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.13 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.12 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.11 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.10 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.9 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.8 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.7 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.6 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
itsf_backend-1.1.5 app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb