debian-mirror-gitlab/app/controllers/admin/application_controller.rb

26 lines
618 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
# Provides a base class for Admin controllers to subclass
#
# Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController
2015-09-11 14:41:01 +05:30
before_action :authenticate_admin!
2018-03-17 18:26:18 +05:30
before_action :display_read_only_information
2014-09-02 18:07:02 +05:30
layout 'admin'
def authenticate_admin!
2017-08-17 22:00:37 +05:30
render_404 unless current_user.admin?
2015-11-26 14:37:03 +05:30
end
2018-03-17 18:26:18 +05:30
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
2014-09-02 18:07:02 +05:30
end