gitlab-org--gitlab-foss/app/controllers/concerns/enforces_admin_authentication.rb
James Fargher beb66cfcba Check instance cluster feature at policy level
Try to simplify feature flag checks by using policies
2019-05-07 08:37:04 +12:00

19 lines
411 B
Ruby

# frozen_string_literal: true
# == EnforcesAdminAuthentication
#
# Controller concern to enforce that users are authenticated as admins
#
# Upon inclusion, adds `authenticate_admin!` as a before_action
#
module EnforcesAdminAuthentication
extend ActiveSupport::Concern
included do
before_action :authenticate_admin!
end
def authenticate_admin!
render_404 unless current_user.admin?
end
end