aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/concerns/policy_checker.rb
blob: d84263f2cd5431e4cc77c0552ae8eb7a17b54483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module PolicyChecker
  include Pundit
  extend ActiveSupport::Concern

  included do
    before_action :authorize_resource, only: [:destroy, :edit, :show, :update]
    before_action :authorize_resource_class, only: [:create, :index, :new]
  end

  protected
  def authorize_resource
    authorize resource
  end

  def authorize_resource_class
    authorize resource_class
  end
end