aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/UserAccounts
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/Connectors/UserAccounts
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/Connectors/UserAccounts')
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs57
1 files changed, 49 insertions, 8 deletions
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 6d5ce28..c21db54 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -32,14 +32,15 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.ServiceAuth;
36using OpenSim.Server.Base; 37using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using OpenMetaverse; 39using OpenMetaverse;
39 40
40namespace OpenSim.Services.Connectors 41namespace OpenSim.Services.Connectors
41{ 42{
42 public class UserAccountServicesConnector : IUserAccountService 43 public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService
43 { 44 {
44 private static readonly ILog m_log = 45 private static readonly ILog m_log =
45 LogManager.GetLogger( 46 LogManager.GetLogger(
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
79 throw new Exception("User account connector init error"); 80 throw new Exception("User account connector init error");
80 } 81 }
81 m_ServerURI = serviceURI; 82 m_ServerURI = serviceURI;
83
84 base.Initialise(source, "UserAccountService");
82 } 85 }
83 86
84 public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 87 public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
@@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors
144 { 147 {
145 reply = SynchronousRestFormsRequester.MakeRequest("POST", 148 reply = SynchronousRestFormsRequester.MakeRequest("POST",
146 uri, 149 uri,
147 reqString); 150 reqString,
151 m_Auth);
148 if (reply == null || (reply != null && reply == string.Empty)) 152 if (reply == null || (reply != null && reply == string.Empty))
149 { 153 {
150 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); 154 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply");
@@ -162,7 +166,7 @@ namespace OpenSim.Services.Connectors
162 166
163 if (replyData != null) 167 if (replyData != null)
164 { 168 {
165 if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null") 169 if (replyData.ContainsKey("result") && replyData["result"].ToString() == "null")
166 { 170 {
167 return accounts; 171 return accounts;
168 } 172 }
@@ -187,6 +191,10 @@ namespace OpenSim.Services.Connectors
187 return accounts; 191 return accounts;
188 } 192 }
189 193
194 public void InvalidateCache(UUID userID)
195 {
196 }
197
190 public virtual bool StoreUserAccount(UserAccount data) 198 public virtual bool StoreUserAccount(UserAccount data)
191 { 199 {
192 Dictionary<string, object> sendData = new Dictionary<string, object>(); 200 Dictionary<string, object> sendData = new Dictionary<string, object>();
@@ -207,9 +215,39 @@ namespace OpenSim.Services.Connectors
207 sendData[kvp.Key] = kvp.Value.ToString(); 215 sendData[kvp.Key] = kvp.Value.ToString();
208 } 216 }
209 217
210 return SendAndGetBoolReply(sendData); 218 if (SendAndGetReply(sendData) != null)
219 return true;
220 else
221 return false;
211 } 222 }
212 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
213 private UserAccount SendAndGetReply(Dictionary<string, object> sendData) 251 private UserAccount SendAndGetReply(Dictionary<string, object> sendData)
214 { 252 {
215 string reply = string.Empty; 253 string reply = string.Empty;
@@ -220,7 +258,8 @@ namespace OpenSim.Services.Connectors
220 { 258 {
221 reply = SynchronousRestFormsRequester.MakeRequest("POST", 259 reply = SynchronousRestFormsRequester.MakeRequest("POST",
222 uri, 260 uri,
223 reqString); 261 reqString,
262 m_Auth);
224 if (reply == null || (reply != null && reply == string.Empty)) 263 if (reply == null || (reply != null && reply == string.Empty))
225 { 264 {
226 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); 265 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply");
@@ -251,14 +290,16 @@ namespace OpenSim.Services.Connectors
251 { 290 {
252 string reqString = ServerUtils.BuildQueryString(sendData); 291 string reqString = ServerUtils.BuildQueryString(sendData);
253 string uri = m_ServerURI + "/accounts"; 292 string uri = m_ServerURI + "/accounts";
254 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); 293 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
255 try 294 try
256 { 295 {
257 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 296 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
258 uri, 297 uri,
259 reqString); 298 reqString,
299 m_Auth);
260 if (reply != string.Empty) 300 if (reply != string.Empty)
261 { 301 {
302 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply);
262 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 303 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
263 304
264 if (replyData.ContainsKey("result")) 305 if (replyData.ContainsKey("result"))