2017-04-10 19:27:03 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class BaseController < ApplicationController
|
2017-11-11 19:23:33 +00:00
|
|
|
include Authorization
|
2017-11-24 01:05:53 +00:00
|
|
|
include AccountableConcern
|
2017-11-11 19:23:33 +00:00
|
|
|
|
2018-10-24 22:10:01 +00:00
|
|
|
layout 'admin'
|
|
|
|
|
2023-04-19 14:07:29 +00:00
|
|
|
before_action :set_cache_headers
|
2024-12-09 22:42:45 +00:00
|
|
|
before_action :set_referrer_policy_header
|
2023-04-19 14:07:29 +00:00
|
|
|
|
2022-07-05 00:41:40 +00:00
|
|
|
after_action :verify_authorized
|
2017-04-10 19:27:03 +00:00
|
|
|
|
2018-10-24 22:10:01 +00:00
|
|
|
private
|
|
|
|
|
2023-04-19 14:07:29 +00:00
|
|
|
def set_cache_headers
|
|
|
|
response.cache_control.replace(private: true, no_store: true)
|
|
|
|
end
|
|
|
|
|
2024-12-09 22:42:45 +00:00
|
|
|
def set_referrer_policy_header
|
|
|
|
response.headers['Referrer-Policy'] = 'same-origin'
|
|
|
|
end
|
|
|
|
|
2018-12-17 10:40:51 +00:00
|
|
|
def set_user
|
|
|
|
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
2017-04-10 19:27:03 +00:00
|
|
|
end
|
|
|
|
end
|