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:
parent
e821020394
commit
9507b448b2
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue