diff options
Diffstat (limited to '')
6 files changed, 117 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 | } |
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index 6c3c655..25ffb63 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs | |||
@@ -100,6 +100,11 @@ namespace OpenSim.Services.HypergridService | |||
100 | return null; | 100 | return null; |
101 | } | 101 | } |
102 | 102 | ||
103 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
104 | { | ||
105 | return null; | ||
106 | } | ||
107 | |||
103 | public void InvalidateCache(UUID userID) | 108 | public void InvalidateCache(UUID userID) |
104 | { | 109 | { |
105 | m_UUIDCache.Remove(userID); | 110 | m_UUIDCache.Remove(userID); |
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 1814699..c6f3ef3 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -187,6 +187,7 @@ namespace OpenSim.Services.Interfaces | |||
187 | /// <returns></returns> | 187 | /// <returns></returns> |
188 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); | 188 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); |
189 | List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where); | 189 | List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where); |
190 | List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs); | ||
190 | 191 | ||
191 | /// <summary> | 192 | /// <summary> |
192 | /// Store the data given, wich replaces the stored data, therefore must be complete. | 193 | /// Store the data given, wich replaces the stored data, therefore must be complete. |
diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs index 9e560d5..225560e 100644 --- a/OpenSim/Services/Interfaces/IUserManagement.cs +++ b/OpenSim/Services/Interfaces/IUserManagement.cs | |||
@@ -42,6 +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 | 46 | ||
46 | /// <summary> | 47 | /// <summary> |
47 | /// 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 6010f0c..668fe53 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -265,6 +265,19 @@ namespace OpenSim.Services.UserAccountService | |||
265 | return MakeUserAccount(d[0]); | 265 | return MakeUserAccount(d[0]); |
266 | } | 266 | } |
267 | 267 | ||
268 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
269 | { | ||
270 | // do it one at a time db access should be fast, so no need to break its api | ||
271 | List<UserAccount> accs = new List<UserAccount>(); | ||
272 | UUID uuid = UUID.Zero; | ||
273 | foreach(string id in IDs) | ||
274 | { | ||
275 | if (UUID.TryParse(id, out uuid) && uuid != UUID.Zero) | ||
276 | accs.Add(GetUserAccount(scopeID, uuid)); | ||
277 | } | ||
278 | return accs; | ||
279 | } | ||
280 | |||
268 | public void InvalidateCache(UUID userID) | 281 | public void InvalidateCache(UUID userID) |
269 | { | 282 | { |
270 | } | 283 | } |