2012-09-16 07:44:54 -04:00
|
|
|
# Provides a base class for Admin controllers to subclass
|
|
|
|
#
|
|
|
|
# Automatically sets the layout and ensures an administrator is logged in
|
2013-01-20 06:20:50 -05:00
|
|
|
class Admin::ApplicationController < ApplicationController
|
2015-04-16 08:03:37 -04:00
|
|
|
before_action :authenticate_admin!
|
2017-09-19 03:44:58 -04:00
|
|
|
before_action :display_read_only_information
|
2015-05-01 04:39:11 -04:00
|
|
|
layout 'admin'
|
2012-09-16 07:44:54 -04:00
|
|
|
|
|
|
|
def authenticate_admin!
|
2017-04-08 22:20:57 -04:00
|
|
|
render_404 unless current_user.admin?
|
2015-10-28 11:39:23 -04:00
|
|
|
end
|
2017-09-19 03:44:58 -04:00
|
|
|
|
|
|
|
def display_read_only_information
|
|
|
|
return unless Gitlab::Database.read_only?
|
|
|
|
|
|
|
|
flash.now[:notice] = read_only_message
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Overridden in EE
|
|
|
|
def read_only_message
|
|
|
|
_('You are on a read-only GitLab instance.')
|
|
|
|
end
|
2012-09-16 07:44:54 -04:00
|
|
|
end
|