Welcome to mirror list, hosted at ThFree Co, Russian Federation.

application_controller.rb « admin « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c27f2ee3c09d5c63e3778e478e8805c4aa2640dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Provides a base class for Admin controllers to subclass
#
# Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController
  before_action :authenticate_admin!
  before_action :display_read_only_information
  layout 'admin'

  def authenticate_admin!
    render_404 unless current_user.admin?
  end

  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
end