diff options
author | Diva Canto | 2015-05-11 19:55:23 -0700 |
---|---|---|
committer | Diva Canto | 2015-05-11 19:55:23 -0700 |
commit | 923a57a91fa9629a844da6cd59ca8e9d2b0fbcde (patch) | |
tree | 859b98b1cdfb51c485d4704e3d0a1292300ca446 /OpenSim/Services/Connectors/UserAccounts | |
parent | Forgot to delete an unused project from Prebuild. Done now. (diff) | |
download | opensim-SC-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.zip opensim-SC-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.gz opensim-SC-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.bz2 opensim-SC-923a57a91fa9629a844da6cd59ca8e9d2b0fbcde.tar.xz |
Added tests for UserAccountService in Robust. In the process fixed a couple of bugs in the network connectors. For some reason the robust-bound code had a CreateUser method, while the client-bound code had no such method. I assume someone is extending the client-side code with their own connectors. I added the missing method, but didn't add it to the service interface.
Diffstat (limited to 'OpenSim/Services/Connectors/UserAccounts')
-rw-r--r-- | OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 3f61d9a..560e6c4 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -215,9 +215,39 @@ namespace OpenSim.Services.Connectors | |||
215 | sendData[kvp.Key] = kvp.Value.ToString(); | 215 | sendData[kvp.Key] = kvp.Value.ToString(); |
216 | } | 216 | } |
217 | 217 | ||
218 | return SendAndGetBoolReply(sendData); | 218 | if (SendAndGetReply(sendData) != null) |
219 | return true; | ||
220 | else | ||
221 | return false; | ||
219 | } | 222 | } |
220 | 223 | ||
224 | /// <summary> | ||
225 | /// Create user remotely. Note this this is not part of the IUserAccountsService | ||
226 | /// </summary> | ||
227 | /// <param name="first"></param> | ||
228 | /// <param name="last"></param> | ||
229 | /// <param name="password"></param> | ||
230 | /// <param name="email"></param> | ||
231 | /// <param name="scopeID"></param> | ||
232 | /// <returns></returns> | ||
233 | public virtual UserAccount CreateUser(string first, string last, string password, string email, UUID scopeID) | ||
234 | { | ||
235 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
236 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
237 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
238 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
239 | sendData["METHOD"] = "createuser"; | ||
240 | |||
241 | sendData["FirstName"] = first; | ||
242 | sendData["LastName"] = last; | ||
243 | sendData["Password"] = password; | ||
244 | if (!string.IsNullOrEmpty(email)) | ||
245 | sendData["Email"] = first; | ||
246 | sendData["ScopeID"] = scopeID.ToString(); | ||
247 | |||
248 | return SendAndGetReply(sendData); | ||
249 | } | ||
250 | |||
221 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | 251 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) |
222 | { | 252 | { |
223 | string reply = string.Empty; | 253 | string reply = string.Empty; |
@@ -260,7 +290,7 @@ namespace OpenSim.Services.Connectors | |||
260 | { | 290 | { |
261 | string reqString = ServerUtils.BuildQueryString(sendData); | 291 | string reqString = ServerUtils.BuildQueryString(sendData); |
262 | string uri = m_ServerURI + "/accounts"; | 292 | string uri = m_ServerURI + "/accounts"; |
263 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | 293 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); |
264 | try | 294 | try |
265 | { | 295 | { |
266 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 296 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
@@ -269,6 +299,7 @@ namespace OpenSim.Services.Connectors | |||
269 | m_Auth); | 299 | m_Auth); |
270 | if (reply != string.Empty) | 300 | if (reply != string.Empty) |
271 | { | 301 | { |
302 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply); | ||
272 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 303 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
273 | 304 | ||
274 | if (replyData.ContainsKey("result")) | 305 | if (replyData.ContainsKey("result")) |