summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-05-01 00:44:01 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-05-01 00:44:01 +0000
commita599442d05e50f1998ef8e77df54240be4ceda1d (patch)
tree89af96b996aaf1a5246ed7e61e0cd8c64ebef259
parent9fdd0862f74cb4b187fe7fe1422746702a4cb953 (diff)
downloadredmine-a599442d05e50f1998ef8e77df54240be4ceda1d.tar.gz
redmine-a599442d05e50f1998ef8e77df54240be4ceda1d.zip
introduce request_store to ensure that the current user doesn't leak across request boundaries (#16685)
Contributed by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@13110 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--Gemfile1
-rw-r--r--app/models/user.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/Gemfile b/Gemfile
index da1cc63ad..436b58a7e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,6 +6,7 @@ gem "jquery-rails", "~> 2.0.2"
gem "coderay", "~> 1.1.0"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
+gem 'request_store'
gem "mime-types"
# Optional gem for LDAP authentication
diff --git a/app/models/user.rb b/app/models/user.rb
index 4a33590f7..fd245c3e8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -626,11 +626,11 @@ class User < Principal
end
def self.current=(user)
- Thread.current[:current_user] = user
+ RequestStore.store[:current_user] = user
end
def self.current
- Thread.current[:current_user] ||= User.anonymous
+ RequestStore.store[:current_user] ||= User.anonymous
end
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only