aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
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/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs27
1 files changed, 8 insertions, 19 deletions
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 72551ef..21eb790 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
41using OpenSim.Services.UserAccountService; 41using OpenSim.Services.UserAccountService;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Framework.ServiceAuth;
44using OpenMetaverse; 45using OpenMetaverse;
45 46
46namespace OpenSim.Server.Handlers.UserAccounts 47namespace OpenSim.Server.Handlers.UserAccounts
@@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts
54 private bool m_AllowSetAccount = false; 55 private bool m_AllowSetAccount = false;
55 56
56 public UserAccountServerPostHandler(IUserAccountService service) 57 public UserAccountServerPostHandler(IUserAccountService service)
57 : this(service, null) {} 58 : this(service, null, null) {}
58 59
59 public UserAccountServerPostHandler(IUserAccountService service, IConfig config) : 60 public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) :
60 base("POST", "/accounts") 61 base("POST", "/accounts", auth)
61 { 62 {
62 m_UserAccountService = service; 63 m_UserAccountService = service;
63 64
@@ -68,7 +69,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
68 } 69 }
69 } 70 }
70 71
71 public override byte[] Handle(string path, Stream requestData, 72 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 73 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 74 {
74 StreamReader sr = new StreamReader(requestData); 75 StreamReader sr = new StreamReader(requestData);
@@ -256,8 +257,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
256 257
257 byte[] CreateUser(Dictionary<string, object> request) 258 byte[] CreateUser(Dictionary<string, object> request)
258 { 259 {
259 if (! 260 if (! request.ContainsKey("FirstName")
260 request.ContainsKey("FirstName")
261 && request.ContainsKey("LastName") 261 && request.ContainsKey("LastName")
262 && request.ContainsKey("Password")) 262 && request.ContainsKey("Password"))
263 return FailureResult(); 263 return FailureResult();
@@ -314,7 +314,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
314 314
315 rootElement.AppendChild(result); 315 rootElement.AppendChild(result);
316 316
317 return DocToBytes(doc); 317 return Util.DocToBytes(doc);
318 } 318 }
319 319
320 private byte[] FailureResult() 320 private byte[] FailureResult()
@@ -336,18 +336,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
336 336
337 rootElement.AppendChild(result); 337 rootElement.AppendChild(result);
338 338
339 return DocToBytes(doc); 339 return Util.DocToBytes(doc);
340 }
341
342 private byte[] DocToBytes(XmlDocument doc)
343 {
344 MemoryStream ms = new MemoryStream();
345 XmlTextWriter xw = new XmlTextWriter(ms, null);
346 xw.Formatting = Formatting.Indented;
347 doc.WriteTo(xw);
348 xw.Flush();
349
350 return ms.ToArray();
351 } 340 }
352 341
353 private byte[] ResultToBytes(Dictionary<string, object> result) 342 private byte[] ResultToBytes(Dictionary<string, object> result)