aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs5
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs92
2 files changed, 97 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 563a1e7..6f613c1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -201,6 +201,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
201 return null; 201 return null;
202 } 202 }
203 203
204 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
205 {
206 return null;
207 }
208
204 public bool StoreUserAccount(UserAccount data) 209 public bool StoreUserAccount(UserAccount data)
205 { 210 {
206// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 211// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 3de0a20..5bc7a1c 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -191,6 +191,98 @@ 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 }