checks_maintenance.rb 509 B

12345678910111213141516
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module ApplicationController::ChecksMaintenance
  3. extend ActiveSupport::Concern
  4. private
  5. def in_maintenance_mode?(user)
  6. return false if session[:switched_from_user_id].present?
  7. return false if Setting.get('maintenance_mode') != true
  8. return false if user.permissions?('admin.maintenance')
  9. Rails.logger.info "Maintenance mode enabled, denied login for user #{user.login}, it's no admin user."
  10. true
  11. end
  12. end