aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/concerns/policy_checker.rb
blob: 65a4428e26adf82bffda53bd7ae91b6a4006cb27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module PolicyChecker
  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