diff options
author | Melanie | 2019-08-07 17:58:08 +0100 |
---|---|---|
committer | Melanie | 2019-08-07 17:58:08 +0100 |
commit | d781742d8e966bedb7ac0f9e637003d090a35375 (patch) | |
tree | bd60ff26f75c3bbf0ae4a1ce8e4f37771d3e53ab | |
parent | Also remove the defaults from Configger (diff) | |
download | opensim-SC-d781742d8e966bedb7ac0f9e637003d090a35375.zip opensim-SC-d781742d8e966bedb7ac0f9e637003d090a35375.tar.gz opensim-SC-d781742d8e966bedb7ac0f9e637003d090a35375.tar.bz2 opensim-SC-d781742d8e966bedb7ac0f9e637003d090a35375.tar.xz |
Fix scope support to get friends list names across co-hosted grids
7 files changed, 37 insertions, 20 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs index 41cfdb6..199eef1 100644 --- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Capabilities.Handlers | |||
70 | return new byte[0]; | 70 | return new byte[0]; |
71 | } | 71 | } |
72 | 72 | ||
73 | Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids); | 73 | Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids, UUID.Zero); |
74 | 74 | ||
75 | OSDMap osdReply = new OSDMap(); | 75 | OSDMap osdReply = new OSDMap(); |
76 | OSDArray agents = new OSDArray(); | 76 | OSDArray agents = new OSDArray(); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ea68581..9f1ea4d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -93,6 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
93 | 93 | ||
94 | private Scene m_Scene; | 94 | private Scene m_Scene; |
95 | private UUID m_AgentID; | 95 | private UUID m_AgentID; |
96 | private UUID m_scopeID; | ||
96 | private Caps m_HostCapsObj; | 97 | private Caps m_HostCapsObj; |
97 | private ModelCost m_ModelCost; | 98 | private ModelCost m_ModelCost; |
98 | 99 | ||
@@ -128,6 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
128 | private bool m_AllowCapHomeLocation = true; | 129 | private bool m_AllowCapHomeLocation = true; |
129 | private bool m_AllowCapGroupMemberData = true; | 130 | private bool m_AllowCapGroupMemberData = true; |
130 | private IUserManagement m_UserManager; | 131 | private IUserManagement m_UserManager; |
132 | private IUserAccountService m_userAccountService; | ||
131 | 133 | ||
132 | 134 | ||
133 | private enum FileAgentInventoryState : int | 135 | private enum FileAgentInventoryState : int |
@@ -201,9 +203,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
201 | m_assetService = m_Scene.AssetService; | 203 | m_assetService = m_Scene.AssetService; |
202 | m_regionName = m_Scene.RegionInfo.RegionName; | 204 | m_regionName = m_Scene.RegionInfo.RegionName; |
203 | m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>(); | 205 | m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>(); |
206 | m_userAccountService = m_Scene.RequestModuleInterface<IUserAccountService>(); | ||
204 | if (m_UserManager == null) | 207 | if (m_UserManager == null) |
205 | m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found"); | 208 | m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found"); |
206 | 209 | ||
210 | UserAccount account = m_userAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, m_AgentID); | ||
211 | m_scopeID = account.ScopeID; | ||
212 | |||
207 | RegisterHandlers(); | 213 | RegisterHandlers(); |
208 | 214 | ||
209 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; | 215 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; |
@@ -1943,11 +1949,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1943 | 1949 | ||
1944 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 1950 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
1945 | string[] ids = query.GetValues("ids"); | 1951 | string[] ids = query.GetValues("ids"); |
1952 | m_log.DebugFormat("[DISPLAYNAMES]: Request for {0} names", ids.Length); | ||
1946 | 1953 | ||
1947 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); | 1954 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids, m_scopeID); |
1948 | |||
1949 | StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); | 1955 | StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); |
1950 | LLSDxmlEncode.AddMap(lsl); | 1956 | LLSDxmlEncode.AddMap(lsl); |
1957 | int ct = 0; | ||
1951 | if(names.Count == 0) | 1958 | if(names.Count == 0) |
1952 | LLSDxmlEncode.AddEmptyArray("agents", lsl); | 1959 | LLSDxmlEncode.AddEmptyArray("agents", lsl); |
1953 | else | 1960 | else |
@@ -1956,13 +1963,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1956 | 1963 | ||
1957 | foreach (KeyValuePair<UUID,string> kvp in names) | 1964 | foreach (KeyValuePair<UUID,string> kvp in names) |
1958 | { | 1965 | { |
1966 | string[] parts = kvp.Value.Split(new char[] {' '}); | ||
1967 | string fullname = kvp.Value; | ||
1968 | |||
1959 | if (string.IsNullOrEmpty(kvp.Value)) | 1969 | if (string.IsNullOrEmpty(kvp.Value)) |
1960 | continue; | 1970 | { |
1971 | parts = new string[] {"(hippos)", ""}; | ||
1972 | fullname = "(hippos)"; | ||
1973 | } | ||
1974 | |||
1961 | if(kvp.Key == UUID.Zero) | 1975 | if(kvp.Key == UUID.Zero) |
1962 | continue; | 1976 | continue; |
1963 | 1977 | ||
1964 | string[] parts = kvp.Value.Split(new char[] {' '}); | ||
1965 | |||
1966 | // dont tell about unknown users, we can't send them back on Bad either | 1978 | // dont tell about unknown users, we can't send them back on Bad either |
1967 | if(parts[0] == "Unknown") | 1979 | if(parts[0] == "Unknown") |
1968 | continue; | 1980 | continue; |
@@ -1970,18 +1982,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1970 | LLSDxmlEncode.AddMap(lsl); | 1982 | LLSDxmlEncode.AddMap(lsl); |
1971 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); | 1983 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); |
1972 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); | 1984 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); |
1973 | LLSDxmlEncode.AddElem("display_name", kvp.Value, lsl); | 1985 | LLSDxmlEncode.AddElem("display_name", fullname, lsl); |
1974 | LLSDxmlEncode.AddElem("legacy_first_name", parts[0], lsl); | 1986 | LLSDxmlEncode.AddElem("legacy_first_name", parts[0], lsl); |
1975 | LLSDxmlEncode.AddElem("legacy_last_name", parts[1], lsl); | 1987 | LLSDxmlEncode.AddElem("legacy_last_name", parts[1], lsl); |
1976 | LLSDxmlEncode.AddElem("username", kvp.Value, lsl); | 1988 | LLSDxmlEncode.AddElem("username", fullname, lsl); |
1977 | LLSDxmlEncode.AddElem("id", kvp.Key, lsl); | 1989 | LLSDxmlEncode.AddElem("id", kvp.Key, lsl); |
1978 | LLSDxmlEncode.AddElem("is_display_name_default", true, lsl); | 1990 | LLSDxmlEncode.AddElem("is_display_name_default", true, lsl); |
1979 | LLSDxmlEncode.AddEndMap(lsl); | 1991 | LLSDxmlEncode.AddEndMap(lsl); |
1992 | ct++; | ||
1980 | } | 1993 | } |
1981 | LLSDxmlEncode.AddEndArray(lsl); | 1994 | LLSDxmlEncode.AddEndArray(lsl); |
1982 | } | 1995 | } |
1983 | 1996 | ||
1984 | LLSDxmlEncode.AddEndMap(lsl); | 1997 | LLSDxmlEncode.AddEndMap(lsl); |
1998 | m_log.DebugFormat("[DISPLAYNAMES]: Returned {0} names", ct); | ||
1985 | return LLSDxmlEncode.End(lsl);; | 1999 | return LLSDxmlEncode.End(lsl);; |
1986 | } | 2000 | } |
1987 | } | 2001 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index c82d45a..40b83f3 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
485 | return user.FirstName + " " + user.LastName; | 485 | return user.FirstName + " " + user.LastName; |
486 | } | 486 | } |
487 | 487 | ||
488 | public virtual Dictionary<UUID,string> GetUsersNames(string[] ids) | 488 | public virtual Dictionary<UUID,string> GetUsersNames(string[] ids, UUID scopeID) |
489 | { | 489 | { |
490 | Dictionary<UUID,string> ret = new Dictionary<UUID,string>(); | 490 | Dictionary<UUID,string> ret = new Dictionary<UUID,string>(); |
491 | if(m_Scenes.Count <= 0) | 491 | if(m_Scenes.Count <= 0) |
@@ -528,7 +528,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
528 | 528 | ||
529 | // try user account service | 529 | // try user account service |
530 | List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts( | 530 | List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts( |
531 | m_Scenes[0].RegionInfo.ScopeID, missing); | 531 | scopeID, missing); |
532 | 532 | ||
533 | if(accounts.Count != 0) | 533 | if(accounts.Count != 0) |
534 | { | 534 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index b510d0a..9574d08 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -164,6 +164,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
164 | 164 | ||
165 | public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | 165 | public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) |
166 | { | 166 | { |
167 | m_log.DebugFormat("[REMOTE USER ACCOUNTS]: Request for {0} records", IDs.Count); | ||
167 | List<UserAccount> accs = new List<UserAccount>(); | 168 | List<UserAccount> accs = new List<UserAccount>(); |
168 | List<string> missing = new List<string>(); | 169 | List<string> missing = new List<string>(); |
169 | 170 | ||
@@ -177,9 +178,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
177 | { | 178 | { |
178 | account = m_Cache.Get(uuid, out inCache); | 179 | account = m_Cache.Get(uuid, out inCache); |
179 | if (inCache) | 180 | if (inCache) |
181 | { | ||
180 | accs.Add(account); | 182 | accs.Add(account); |
183 | m_log.DebugFormat("[REMOTE USER ACCOUNTS]: Found in cache: {0}, is null {1}", uuid, account == null); | ||
184 | } | ||
181 | else | 185 | else |
186 | { | ||
182 | missing.Add(id); | 187 | missing.Add(id); |
188 | } | ||
183 | } | 189 | } |
184 | } | 190 | } |
185 | 191 | ||
@@ -198,6 +204,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
198 | } | 204 | } |
199 | } | 205 | } |
200 | } | 206 | } |
207 | m_log.DebugFormat("[REMOTE USER ACCOUNTS]: returned {0} records", accs.Count); | ||
201 | return accs; | 208 | return accs; |
202 | } | 209 | } |
203 | 210 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index dd4f974..5a38501 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -608,6 +608,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
608 | size += 8; | 608 | size += 8; |
609 | else if (o is double) | 609 | else if (o is double) |
610 | size += 16; | 610 | size += 16; |
611 | else if (o is list) | ||
612 | size += ((list)o).Size; | ||
611 | else | 613 | else |
612 | throw new Exception("Unknown type in List.Size: " + o.GetType().ToString()); | 614 | throw new Exception("Unknown type in List.Size: " + o.GetType().ToString()); |
613 | } | 615 | } |
diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs index 3bdf86d..39268c0 100644 --- a/OpenSim/Services/Interfaces/IUserManagement.cs +++ b/OpenSim/Services/Interfaces/IUserManagement.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Services.Interfaces | |||
42 | string GetUserUUI(UUID uuid); | 42 | string GetUserUUI(UUID uuid); |
43 | bool GetUserUUI(UUID userID, out string uui); | 43 | bool GetUserUUI(UUID userID, out string uui); |
44 | string GetUserServerURL(UUID uuid, string serverType); | 44 | string GetUserServerURL(UUID uuid, string serverType); |
45 | Dictionary<UUID,string> GetUsersNames(string[] ids); | 45 | Dictionary<UUID,string> GetUsersNames(string[] ids, UUID scopeID); |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Get user ID by the given name. | 48 | /// Get user ID by the given name. |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 24f436d..9ac8418 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Linq; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
@@ -292,15 +293,8 @@ namespace OpenSim.Services.UserAccountService | |||
292 | 293 | ||
293 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | 294 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) |
294 | { | 295 | { |
295 | // do it one at a time db access should be fast, so no need to break its api | 296 | UserAccountData[] ret = m_Database.GetUsersWhere(scopeID, "PrincipalID in ('" + String.Join("', '", IDs) + "')"); |
296 | List<UserAccount> accs = new List<UserAccount>(); | 297 | return new List<UserAccount>(ret.Select((x) => MakeUserAccount(x))); |
297 | UUID uuid = UUID.Zero; | ||
298 | foreach(string id in IDs) | ||
299 | { | ||
300 | if (UUID.TryParse(id, out uuid) && uuid != UUID.Zero) | ||
301 | accs.Add(GetUserAccount(scopeID, uuid)); | ||
302 | } | ||
303 | return accs; | ||
304 | } | 298 | } |
305 | 299 | ||
306 | public void InvalidateCache(UUID userID) | 300 | public void InvalidateCache(UUID userID) |