diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-19 21:17:52 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-19 21:17:52 +0000 |
commit | b895f6434dddba9dc7575119491b695f607b93f4 (patch) | |
tree | fd667623e188a73a494cc6985738b691aecc987a /lib | |
parent | 8cf83d494c69fc0679f5e2e48396ae356fa89053 (diff) | |
download | redmine-b895f6434dddba9dc7575119491b695f607b93f4.tar.gz redmine-b895f6434dddba9dc7575119491b695f607b93f4.zip |
Make the sudo timeout configurable (#19851).
git-svn-id: http://svn.redmine.org/redmine/trunk@14353 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/sudo_mode.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/redmine/sudo_mode.rb b/lib/redmine/sudo_mode.rb index bcbdd28f2..afb510ea4 100644 --- a/lib/redmine/sudo_mode.rb +++ b/lib/redmine/sudo_mode.rb @@ -4,10 +4,6 @@ require 'rack/utils' module Redmine module SudoMode - # timespan after which sudo mode expires when unused. - MAX_INACTIVITY = 15.minutes - - class SudoRequired < StandardError end @@ -132,7 +128,7 @@ module Redmine end def sudo_timestamp_valid? - session[:sudo_timestamp].to_i > MAX_INACTIVITY.ago.to_i + session[:sudo_timestamp].to_i > SudoMode.timeout.ago.to_i end def update_sudo_timestamp!(new_value = Time.now.to_i) @@ -218,6 +214,10 @@ module Redmine def self.enabled? Redmine::Configuration['sudo_mode'] && !RequestStore.store[:sudo_mode_disabled] end + + # Timespan after which sudo mode expires when unused. + def self.timeout + Redmine::Configuration['sudo_mode_timeout'].to_i.minutes + end end end - |