From 58af0fabeb909452e1db615afd05a1bb78678191 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 31 Jul 2008 15:53:07 +0000 Subject: [PATCH] * minor: reduce coupling by passing in only session id to CachedUserInfo --- .../Framework/Communications/Cache/CachedUserInfo.cs | 12 ++++++++++-- .../Communications/Cache/UserProfileCacheService.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 11516f0a06..4c0aaa22f0 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -101,11 +101,19 @@ namespace OpenSim.Framework.Communications.Cache m_userProfile = userProfile; } - public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, IClientAPI remoteClient) + /// + /// Constructor + /// + /// + /// + /// + /// Session id of the user. This is used in subsequent security checks. + /// + public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, LLUUID sessionId) { m_commsManager = commsManager; m_userProfile = userProfile; - m_session_id = remoteClient.SessionId; + m_session_id = sessionId; } /// diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index d6421b0d64..5f98c085be 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -71,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache if (!m_userProfiles.ContainsKey(remoteClient.AgentId)) { UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(remoteClient.AgentId); - CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile, remoteClient); + CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile, remoteClient.SessionId); if (userInfo.UserProfile != null) { diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 108c1d006b..2b3ffd8299 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -689,6 +689,13 @@ namespace OpenSim m_log.ErrorFormat("[CONSOLE]: Failed to find user {0} {1}", firstName, lastName); return; } + + CachedUserInfo userInfo = m_commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); + if (null == userInfo) + { + m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); + return; + } } ///