maintenance_mode / User.current is always Anonymous
I'm having an issue with Redmine maintenance (dispatcher already changed:)
module MaintenanceMode def self.included(base) base.class_eval do unloadable prepend_before_filter(:show_maintenance_mode_page) def show_maintenance_mode_page unless User.current.admin? render :text => "This site is currently under maintenance. Please check back later." return false end end end end end # Patches to the Redmine core. ActionDispatch::Callbacks.to_prepare do require_dependency 'application_controller' ApplicationController.send(:include, MaintenanceMode) end
The maintenance text is always displayed, even if I'm authenticated and my user is admin.
User.current.lastnameas debug output and it's always "Anonymous"...
Any ideas why?
Perhaps this happens before the user is retrieved from the session. Is there an
RE: maintenance_mode / User.current is always Anonymous - Added by Jan Niggemann (redmine.org team member) almost 9 years ago
OMG, you're right it was the filter chain...
before_filter... and it works.
hey guys, I made a "real" plugin out of this code.
check it out: http://www.redmine.org/plugins/redmine_maintenance_mode