Makes User.current thread safe (#12097).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10911 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-12-02 18:15:46 +00:00
parent e821020394
commit 9507b448b2
1 changed files with 2 additions and 2 deletions

View File

@ -601,11 +601,11 @@ class User < Principal
end end
def self.current=(user) def self.current=(user)
@current_user = user Thread.current[:current_user] = user
end end
def self.current def self.current
@current_user ||= User.anonymous Thread.current[:current_user] ||= User.anonymous
end end
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only