aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/GridUser
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs29
2 files changed, 14 insertions, 20 deletions
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
index 66f35e3..1e29378 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs
@@ -29,6 +29,7 @@ using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Server.Base; 30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces; 31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.ServiceAuth;
32using OpenSim.Framework.Servers.HttpServer; 33using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base; 34using OpenSim.Server.Handlers.Base;
34 35
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser
55 Object[] args = new Object[] { config }; 56 Object[] args = new Object[] { config };
56 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); 57 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
57 58
58 server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService)); 59 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ;
60
61 server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth));
59 } 62 }
60 } 63 }
61} 64}
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 687cf8d..9237c63 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -39,6 +39,7 @@ using System.Collections.Generic;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.ServiceAuth;
42using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
43using OpenMetaverse; 44using OpenMetaverse;
44 45
@@ -50,13 +51,13 @@ namespace OpenSim.Server.Handlers.GridUser
50 51
51 private IGridUserService m_GridUserService; 52 private IGridUserService m_GridUserService;
52 53
53 public GridUserServerPostHandler(IGridUserService service) : 54 public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) :
54 base("POST", "/griduser") 55 base("POST", "/griduser", auth)
55 { 56 {
56 m_GridUserService = service; 57 m_GridUserService = service;
57 } 58 }
58 59
59 public override byte[] Handle(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 62 {
62 StreamReader sr = new StreamReader(requestData); 63 StreamReader sr = new StreamReader(requestData);
@@ -185,10 +186,12 @@ namespace OpenSim.Server.Handlers.GridUser
185 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); 186 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
186 187
187 Dictionary<string, object> result = new Dictionary<string, object>(); 188 Dictionary<string, object> result = new Dictionary<string, object>();
188 result["result"] = guinfo.ToKeyValuePairs(); 189 if (guinfo != null)
190 result["result"] = guinfo.ToKeyValuePairs();
191 else
192 result["result"] = "null";
189 193
190 string xmlString = ServerUtils.BuildXmlResponse(result); 194 string xmlString = ServerUtils.BuildXmlResponse(result);
191
192 //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); 195 //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
193 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 196 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
194 } 197 }
@@ -276,7 +279,7 @@ namespace OpenSim.Server.Handlers.GridUser
276 279
277 rootElement.AppendChild(result); 280 rootElement.AppendChild(result);
278 281
279 return DocToBytes(doc); 282 return Util.DocToBytes(doc);
280 } 283 }
281 284
282 private byte[] FailureResult() 285 private byte[] FailureResult()
@@ -298,20 +301,8 @@ namespace OpenSim.Server.Handlers.GridUser
298 301
299 rootElement.AppendChild(result); 302 rootElement.AppendChild(result);
300 303
301 return DocToBytes(doc); 304 return Util.DocToBytes(doc);
302 } 305 }
303 306
304 private byte[] DocToBytes(XmlDocument doc)
305 {
306 MemoryStream ms = new MemoryStream();
307 XmlTextWriter xw = new XmlTextWriter(ms, null);
308 xw.Formatting = Formatting.Indented;
309 doc.WriteTo(xw);
310 xw.Flush();
311
312 return ms.ToArray();
313 }
314
315
316 } 307 }
317} 308}