From e2b7d941b601bfeb5923a66f6dd0aaf17b76db91 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 5 Sep 2013 07:44:27 -0700 Subject: [PATCH] Restore group membership check for HG users in QueryAccess. --- .../Hypergrid/GroupsServiceHGConnectorModule.cs | 9 ++++++--- .../UserManagement/UserManagementModule.cs | 14 ++++++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +----- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs index 4642b2adaf..7d4851652b 100644 --- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs +++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs @@ -623,10 +623,13 @@ namespace OpenSim.Groups if (agent != null) break; } - if (agent == null) // oops - return AgentID.ToString(); + if (agent != null) + return Util.ProduceUserUniversalIdentifier(agent); + + // we don't know anything about this foreign user + // try asking the user management module, which may know more + return m_UserManagement.GetUserUUI(AgentID); - return Util.ProduceUserUniversalIdentifier(agent); } private string AgentUUIForOutside(string AgentIDStr) diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 7adb203bed..8c983e68d5 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -481,14 +481,20 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement public string GetUserUUI(UUID userID) { - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); - if (account != null) - return userID.ToString(); - UserData ud; lock (m_UserCache) m_UserCache.TryGetValue(userID, out ud); + if (ud == null) // It's not in the cache + { + string[] names = new string[2]; + // This will pull the data from either UserAccounts or GridUser + // and stick it into the cache + TryGetUserNamesFromServices(userID, names); + lock (m_UserCache) + m_UserCache.TryGetValue(userID, out ud); + } + if (ud != null) { string homeURL = ud.HomeURL; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3eaa8fd5fb..e00206ff52 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5801,11 +5801,7 @@ namespace OpenSim.Region.Framework.Scenes try { - // If this is a hypergrid user, then we can't perform a successful groups access check here since this - // currently relies on a circuit being present in the AuthenticateHandler to construct a Hypergrid ID. - // This is only present in NewUserConnection() which entity transfer calls very soon after QueryAccess(). - // Therefore, we'll defer to the check in NewUserConnection() instead. - if (!AuthorizeUser(aCircuit, !UserManagementModule.IsLocalGridUser(agentID), out reason)) + if (!AuthorizeUser(aCircuit, false, out reason)) { //m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); return false;