From 923a57a91fa9629a844da6cd59ca8e9d2b0fbcde Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 11 May 2015 19:55:23 -0700 Subject: 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. --- .../UserAccounts/UserAccountServicesConnector.cs | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Connectors') 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 sendData[kvp.Key] = kvp.Value.ToString(); } - return SendAndGetBoolReply(sendData); + if (SendAndGetReply(sendData) != null) + return true; + else + return false; } + /// + /// Create user remotely. Note this this is not part of the IUserAccountsService + /// + /// + /// + /// + /// + /// + /// + public virtual UserAccount CreateUser(string first, string last, string password, string email, UUID scopeID) + { + Dictionary sendData = new Dictionary(); + //sendData["SCOPEID"] = scopeID.ToString(); + sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); + sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); + sendData["METHOD"] = "createuser"; + + sendData["FirstName"] = first; + sendData["LastName"] = last; + sendData["Password"] = password; + if (!string.IsNullOrEmpty(email)) + sendData["Email"] = first; + sendData["ScopeID"] = scopeID.ToString(); + + return SendAndGetReply(sendData); + } + private UserAccount SendAndGetReply(Dictionary sendData) { string reply = string.Empty; @@ -260,7 +290,7 @@ namespace OpenSim.Services.Connectors { string reqString = ServerUtils.BuildQueryString(sendData); string uri = m_ServerURI + "/accounts"; - // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); + //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", @@ -269,6 +299,7 @@ namespace OpenSim.Services.Connectors m_Auth); if (reply != string.Empty) { + //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply); Dictionary replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) -- cgit v1.1