2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2019-09-05 14:02:31 +00:00
|
|
|
module ApplicationController::ChecksMaintenance
|
2017-03-09 11:44:51 +00:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-09-05 14:02:31 +00:00
|
|
|
def in_maintenance_mode?(user)
|
2017-03-09 11:44:51 +00:00
|
|
|
return false if Setting.get('maintenance_mode') != true
|
|
|
|
return false if user.permissions?('admin.maintenance')
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2017-03-09 11:44:51 +00:00
|
|
|
Rails.logger.info "Maintenance mode enabled, denied login for user #{user.login}, it's no admin user."
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|