BigW Consortium Gitlab

application_controller.rb 478 Bytes
Newer Older
1 2 3
# Provides a base class for Admin controllers to subclass
#
# Automatically sets the layout and ensures an administrator is logged in
4
class Admin::ApplicationController < ApplicationController
5
  before_action :authenticate_admin!
6
  layout 'admin'
7 8 9 10

  def authenticate_admin!
    return render_404 unless current_user.is_admin?
  end
11 12 13 14 15 16

  def authorize_impersonator!
    if session[:impersonator_id]
      User.find_by!(username: session[:impersonator_id]).admin?
    end
  end
17
end