Sha256: 3a9865e798e208749df738e6fdfe027aa60e39830c05e4e71edd198a42badd8f
Contents?: true
Size: 828 Bytes
Versions: 14
Compression:
Stored size: 828 Bytes
Contents
# ApplicationController should inherit from this controller. class WcmsApplicationController < ActionController::Base include Pundit before_action :authenticate! after_action :verify_authorized after_action :verify_policy_scoped, only: :index rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized layout -> { (@layout || :application).to_s } helper_method :current_user def current_user authentication.user end protected def authenticate! authentication.perform or render_error_page(401) end def authentication @authentication ||= CasAuthentication.new(session) end def render_error_page(status) render file: "#{Rails.root}/public/#{status}", formats: [:html], status: status, layout: false end def user_not_authorized render_error_page(403) end end
Version data entries
14 entries across 14 versions & 1 rubygems