From 9f88273741cbe2bb46535fd0061258bbc695a121 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Aug 2016 06:24:58 +0100 Subject: add GetMultiAccounts USER SERVICE HANDLER. UNTESTED !!! --- .../UserAccounts/UserAccountServerPostHandler.cs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 21eb790..9efe741 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -103,6 +103,8 @@ namespace OpenSim.Server.Handlers.UserAccounts return GetAccount(request); case "getaccounts": return GetAccounts(request); + case "getmultiaccounts": + return GetMultiAccounts(request); case "setaccount": if (m_AllowSetAccount) return StoreAccount(request); @@ -201,6 +203,50 @@ namespace OpenSim.Server.Handlers.UserAccounts return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + byte[] GetMultiAccounts(Dictionary request) + { + UUID scopeID = UUID.Zero; + if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) + return FailureResult(); + + if (!request.ContainsKey("IDS")) + { + m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts called without required uuids argument"); + return FailureResult(); + } + + if (!(request["IDS"] is List)) + { + m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts input argument was of unexpected type {0}", request["IDS"].GetType().ToString()); + return FailureResult(); + } + + List userIDs = (List)request["IDS"]; + + List accounts = m_UserAccountService.GetUserAccounts(scopeID, userIDs); + + Dictionary result = new Dictionary(); + if ((accounts == null) || ((accounts != null) && (accounts.Count == 0))) + { + result["result"] = "null"; + } + else + { + int i = 0; + foreach (UserAccount acc in accounts) + { + Dictionary rinfoDict = acc.ToKeyValuePairs(); + result["account" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + byte[] StoreAccount(Dictionary request) { UUID principalID = UUID.Zero; -- cgit v1.1