diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Services/Connectors/UserAccounts | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | 99 |
1 files changed, 98 insertions, 1 deletions
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index c21db54..68ae7bb 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -191,10 +191,107 @@ namespace OpenSim.Services.Connectors | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | public virtual List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
195 | { | ||
196 | List<UserAccount> accs = new List<UserAccount>(); | ||
197 | bool multisuported = true; | ||
198 | accs = doGetMultiUserAccounts(scopeID, IDs, out multisuported); | ||
199 | if(multisuported) | ||
200 | return accs; | ||
201 | |||
202 | // service does not do multi accounts so need to do it one by one | ||
203 | |||
204 | UUID uuid = UUID.Zero; | ||
205 | foreach(string id in IDs) | ||
206 | { | ||
207 | if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero) | ||
208 | accs.Add(GetUserAccount(scopeID,uuid)); | ||
209 | } | ||
210 | |||
211 | return accs; | ||
212 | } | ||
213 | |||
214 | private List<UserAccount> doGetMultiUserAccounts(UUID scopeID, List<string> IDs, out bool suported) | ||
215 | { | ||
216 | suported = true; | ||
217 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
218 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
219 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
220 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
221 | sendData["METHOD"] = "getmultiaccounts"; | ||
222 | |||
223 | sendData["ScopeID"] = scopeID.ToString(); | ||
224 | sendData["IDS"] = new List<string>(IDs); | ||
225 | |||
226 | string reply = string.Empty; | ||
227 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
228 | string uri = m_ServerURI + "/accounts"; | ||
229 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | ||
230 | try | ||
231 | { | ||
232 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
233 | uri, | ||
234 | reqString, | ||
235 | m_Auth); | ||
236 | if (reply == null || (reply != null && reply == string.Empty)) | ||
237 | { | ||
238 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received null or empty reply"); | ||
239 | return null; | ||
240 | } | ||
241 | } | ||
242 | catch (Exception e) | ||
243 | { | ||
244 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message); | ||
245 | } | ||
246 | |||
247 | List<UserAccount> accounts = new List<UserAccount>(); | ||
248 | |||
249 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
250 | |||
251 | if (replyData != null) | ||
252 | { | ||
253 | if (replyData.ContainsKey("result")) | ||
254 | { | ||
255 | if(replyData["result"].ToString() == "null") | ||
256 | return accounts; | ||
257 | |||
258 | if(replyData["result"].ToString() == "Failure") | ||
259 | { | ||
260 | suported = false; | ||
261 | return accounts; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | Dictionary<string, object>.ValueCollection accountList = replyData.Values; | ||
266 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); | ||
267 | foreach (object acc in accountList) | ||
268 | { | ||
269 | if (acc is Dictionary<string, object>) | ||
270 | { | ||
271 | UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc); | ||
272 | accounts.Add(pinfo); | ||
273 | } | ||
274 | else | ||
275 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received invalid response type {0}", | ||
276 | acc.GetType()); | ||
277 | } | ||
278 | } | ||
279 | else | ||
280 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetMultiUserAccounts received null response"); | ||
281 | |||
282 | return accounts; | ||
283 | } | ||
284 | |||
285 | |||
194 | public void InvalidateCache(UUID userID) | 286 | public void InvalidateCache(UUID userID) |
195 | { | 287 | { |
196 | } | 288 | } |
197 | 289 | ||
290 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
291 | { | ||
292 | return null; // Not implemented for regions | ||
293 | } | ||
294 | |||
198 | public virtual bool StoreUserAccount(UserAccount data) | 295 | public virtual bool StoreUserAccount(UserAccount data) |
199 | { | 296 | { |
200 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 297 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
@@ -247,7 +344,7 @@ namespace OpenSim.Services.Connectors | |||
247 | 344 | ||
248 | return SendAndGetReply(sendData); | 345 | return SendAndGetReply(sendData); |
249 | } | 346 | } |
250 | 347 | ||
251 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | 348 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) |
252 | { | 349 | { |
253 | string reply = string.Empty; | 350 | string reply = string.Empty; |