aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2009-12-29 15:58:40 -0800
committerDiva Canto2009-12-29 15:58:40 -0800
commitb4483df2701483aabd43fc7d03ebd74770d70170 (patch)
treed36e88b1409e438be222e0a994b6ca563fe26850
parentTighten up the IUserService interface again. No need for auth tokens at this ... (diff)
downloadopensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.zip
opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.gz
opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.bz2
opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.xz
* All modules and connectors for user account service are in place. Untested.
* Cleaned up a few things on presence connectors
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs)0
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs)0
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs176
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs (renamed from OpenSim/Services/Connectors/User/UserServiceConnector.cs)94
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs4
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs61
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs276
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs28
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserServiceConnector.cs287
-rw-r--r--OpenSim/Services/Interfaces/IUserService.cs4
11 files changed, 867 insertions, 67 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 79796b1..a7acc43 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -48,9 +48,11 @@
48 <RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" /> 48 <RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" />
49 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> 49 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" />
50 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> 50 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" />
51 <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" />
51 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> 52 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" />
52 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> 53 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" />
53 <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" /> 54 <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.User.LocalUserAccountServicesConnector" />
55 <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.User.RemoteUserAccountServicesConnector" />
54 <!-- Service connectors IN modules --> 56 <!-- Service connectors IN modules -->
55 <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> 57 <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
56 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> 58 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs
index cca5bb4..cca5bb4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs
index cef9129..cef9129 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs
new file mode 100644
index 0000000..e40d524
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs
@@ -0,0 +1,176 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37
38using OpenMetaverse;
39
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
41{
42 public class LocalUserAccountServicesConnector : ISharedRegionModule, IUserAccountService
43 {
44 private static readonly ILog m_log =
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47
48 private IUserAccountService m_UserService;
49
50 private bool m_Enabled = false;
51
52 #region ISharedRegionModule
53
54 public Type ReplaceableInterface
55 {
56 get { return null; }
57 }
58
59 public string Name
60 {
61 get { return "LocalUserAccountServicesConnector"; }
62 }
63
64 public void Initialise(IConfigSource source)
65 {
66 IConfig moduleConfig = source.Configs["Modules"];
67 if (moduleConfig != null)
68 {
69 string name = moduleConfig.GetString("UserAccountServices", "");
70 if (name == Name)
71 {
72 IConfig userConfig = source.Configs["UserAccountService"];
73 if (userConfig == null)
74 {
75 m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpenSim.ini");
76 return;
77 }
78
79 string serviceDll = userConfig.GetString("LocalServiceModule",
80 String.Empty);
81
82 if (serviceDll == String.Empty)
83 {
84 m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService");
85 return;
86 }
87
88 Object[] args = new Object[] { source };
89 m_UserService =
90 ServerUtils.LoadPlugin<IUserAccountService>(serviceDll,
91 args);
92
93 if (m_UserService == null)
94 {
95 m_log.Error("[USER CONNECTOR]: Can't load user account service");
96 return;
97 }
98 m_Enabled = true;
99 m_log.Info("[USER CONNECTOR]: Local user connector enabled");
100 }
101 }
102 }
103
104 public void PostInitialise()
105 {
106 if (!m_Enabled)
107 return;
108 }
109
110 public void Close()
111 {
112 if (!m_Enabled)
113 return;
114 }
115
116 public void AddRegion(Scene scene)
117 {
118 if (!m_Enabled)
119 return;
120
121 scene.RegisterModuleInterface<IUserAccountService>(m_UserService);
122 }
123
124 public void RemoveRegion(Scene scene)
125 {
126 if (!m_Enabled)
127 return;
128 }
129
130 public void RegionLoaded(Scene scene)
131 {
132 if (!m_Enabled)
133 return;
134 }
135
136 #endregion
137
138 #region IUserAccountService
139
140 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
141 {
142 return m_UserService.GetUserAccount(scopeID, userID);
143 }
144
145 public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName)
146 {
147 return m_UserService.GetUserAccount(scopeID, FirstName, LastName);
148 }
149
150 public UserAccount GetUserAccount(UUID scopeID, string Email)
151 {
152 return m_UserService.GetUserAccount(scopeID, Email);
153 }
154
155 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
156 {
157 return m_UserService.GetUserAccounts(scopeID, query);
158 }
159
160 // Update all updatable fields
161 //
162 public bool SetUserAccount(UserAccount data)
163 {
164 return m_UserService.SetUserAccount(data);
165 }
166
167 // Creates a user data record
168 public bool CreateUserAccount(UserAccount data)
169 {
170 return m_UserService.CreateUserAccount(data);
171 }
172
173 #endregion
174
175 }
176}
diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs
index 0de8c1d..0b72080 100644
--- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs
@@ -25,90 +25,90 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net;
29using System; 28using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config; 29using Nini.Config;
34using OpenSim.Framework; 30using log4net;
35using OpenSim.Framework.Communications; 31using System.Reflection;
36using OpenSim.Framework.Servers.HttpServer; 32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
38using OpenMetaverse; 35using OpenSim.Services.Connectors;
39 36
40namespace OpenSim.Services.Connectors 37namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
41{ 38{
42 public class UserServicesConnector : IUserAccountService 39 public class RemoteUserAccountServicesConnector : UserAccountServicesConnector,
40 ISharedRegionModule, IUserAccountService
43 { 41 {
44 private static readonly ILog m_log = 42 private static readonly ILog m_log =
45 LogManager.GetLogger( 43 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType); 44 MethodBase.GetCurrentMethod().DeclaringType);
47 45
48// private string m_ServerURI = String.Empty; 46 private bool m_Enabled = false;
49
50 public UserServicesConnector()
51 {
52 }
53 47
54 public UserServicesConnector(string serverURI) 48 public Type ReplaceableInterface
55 { 49 {
56// m_ServerURI = serverURI.TrimEnd('/'); 50 get { return null; }
57 } 51 }
58 52
59 public UserServicesConnector(IConfigSource source) 53 public string Name
60 { 54 {
61 Initialise(source); 55 get { return "RemoteUserAccountServicesConnector"; }
62 } 56 }
63 57
64 public virtual void Initialise(IConfigSource source) 58 public override void Initialise(IConfigSource source)
65 { 59 {
66 IConfig assetConfig = source.Configs["UserService"]; 60 IConfig moduleConfig = source.Configs["Modules"];
67 if (assetConfig == null) 61 if (moduleConfig != null)
68 { 62 {
69 m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini"); 63 string name = moduleConfig.GetString("UserServices", "");
70 throw new Exception("User connector init error"); 64 if (name == Name)
71 } 65 {
66 IConfig userConfig = source.Configs["UserService"];
67 if (userConfig == null)
68 {
69 m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini");
70 return;
71 }
72 72
73 string serviceURI = assetConfig.GetString("UserServerURI", 73 m_Enabled = true;
74 String.Empty);
75 74
76 if (serviceURI == String.Empty) 75 base.Initialise(source);
77 { 76
78 m_log.Error("[USER CONNECTOR]: No Server URI named in section UserService"); 77 m_log.Info("[USER CONNECTOR]: Remote users enabled");
79 throw new Exception("User connector init error"); 78 }
80 } 79 }
81 //m_ServerURI = serviceURI;
82 } 80 }
83 81
84 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 82 public void PostInitialise()
85 { 83 {
86 return null; 84 if (!m_Enabled)
85 return;
87 } 86 }
88 87
89 public UserAccount GetUserAccount(UUID scopeID, string email) 88 public void Close()
90 { 89 {
91 return null; 90 if (!m_Enabled)
92 } 91 return;
93
94 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
95 {
96 return null;
97 } 92 }
98 93
99 public bool SetUserAccount(UserAccount data) 94 public void AddRegion(Scene scene)
100 { 95 {
101 return false; 96 if (!m_Enabled)
97 return;
98
99 scene.RegisterModuleInterface<IUserAccountService>(this);
102 } 100 }
103 101
104 public bool CreateUserAccount(UserAccount data) 102 public void RemoveRegion(Scene scene)
105 { 103 {
106 return false; 104 if (!m_Enabled)
105 return;
107 } 106 }
108 107
109 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 108 public void RegionLoaded(Scene scene)
110 { 109 {
111 return null; 110 if (!m_Enabled)
111 return;
112 } 112 }
113 } 113 }
114} 114}
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index bb00a00..11adc4a 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Server.Handlers.Presence
265 265
266 doc.AppendChild(rootElement); 266 doc.AppendChild(rootElement);
267 267
268 XmlElement result = doc.CreateElement("", "Result", ""); 268 XmlElement result = doc.CreateElement("", "result", "");
269 result.AppendChild(doc.CreateTextNode("Success")); 269 result.AppendChild(doc.CreateTextNode("Success"));
270 270
271 rootElement.AppendChild(result); 271 rootElement.AppendChild(result);
@@ -287,7 +287,7 @@ namespace OpenSim.Server.Handlers.Presence
287 287
288 doc.AppendChild(rootElement); 288 doc.AppendChild(rootElement);
289 289
290 XmlElement result = doc.CreateElement("", "Result", ""); 290 XmlElement result = doc.CreateElement("", "result", "");
291 result.AppendChild(doc.CreateTextNode("Failure")); 291 result.AppendChild(doc.CreateTextNode("Failure"));
292 292
293 rootElement.AppendChild(result); 293 rootElement.AppendChild(result);
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs
new file mode 100644
index 0000000..f17a8de
--- /dev/null
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs
@@ -0,0 +1,61 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34
35namespace OpenSim.Server.Handlers.UserAccounts
36{
37 public class UserAccountServiceConnector : ServiceConnector
38 {
39 private IUserAccountService m_UserAccountService;
40 private string m_ConfigName = "UserAccountService";
41
42 public UserAccountServiceConnector(IConfigSource config, IHttpServer server, string configName) :
43 base(config, server, configName)
44 {
45 IConfig serverConfig = config.Configs[m_ConfigName];
46 if (serverConfig == null)
47 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
48
49 string service = serverConfig.GetString("LocalServiceModule",
50 String.Empty);
51
52 if (service == String.Empty)
53 throw new Exception("No LocalServiceModule in config file");
54
55 Object[] args = new Object[] { config };
56 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args);
57
58 server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService));
59 }
60 }
61}
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
new file mode 100644
index 0000000..a92148c
--- /dev/null
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -0,0 +1,276 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nini.Config;
29using log4net;
30using System;
31using System.Reflection;
32using System.IO;
33using System.Net;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Xml;
37using System.Xml.Serialization;
38using System.Collections.Generic;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers.HttpServer;
43using OpenMetaverse;
44
45namespace OpenSim.Server.Handlers.UserAccounts
46{
47 public class UserAccountServerPostHandler : BaseStreamHandler
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private IUserAccountService m_UserAccountService;
52
53 public UserAccountServerPostHandler(IUserAccountService service) :
54 base("POST", "/accounts")
55 {
56 m_UserAccountService = service;
57 }
58
59 public override byte[] Handle(string path, Stream requestData,
60 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
61 {
62 StreamReader sr = new StreamReader(requestData);
63 string body = sr.ReadToEnd();
64 sr.Close();
65 body = body.Trim();
66
67 // We need to check the authorization header
68 //httpRequest.Headers["authorization"] ...
69
70 //m_log.DebugFormat("[XXX]: query String: {0}", body);
71
72 try
73 {
74 Dictionary<string, object> request =
75 ServerUtils.ParseQueryString(body);
76
77 if (!request.ContainsKey("METHOD"))
78 return FailureResult();
79
80 string method = request["METHOD"].ToString();
81
82 switch (method)
83 {
84 case "getaccount":
85 return GetAccount(request);
86 case "getaccounts":
87 return GetAccounts(request);
88 case "createaccount":
89 return CreateAccount(request);
90 case "setaccount":
91 return SetAccount(request);
92 }
93 m_log.DebugFormat("[PRESENCE HANDLER]: unknown method request: {0}", method);
94 }
95 catch (Exception e)
96 {
97 m_log.Debug("[PRESENCE HANDLER]: Exception {0}" + e);
98 }
99
100 return FailureResult();
101
102 }
103
104 byte[] GetAccount(Dictionary<string, object> request)
105 {
106 UserAccount account = null;
107 UUID scopeID = UUID.Zero;
108 Dictionary<string, object> result = new Dictionary<string, object>();
109
110 if (!request.ContainsKey("ScopeID"))
111 {
112 result["result"] = "null";
113 return ResultToBytes(result);
114 }
115
116 if (!UUID.TryParse(request["ScopeID"].ToString(), out scopeID))
117 {
118 result["result"] = "null";
119 return ResultToBytes(result);
120 }
121
122 if (request.ContainsKey("UserID") && request["UserID"] != null)
123 {
124 UUID userID;
125 if (UUID.TryParse(request["UserID"].ToString(), out userID))
126 account = m_UserAccountService.GetUserAccount(scopeID, userID);
127 }
128
129 else if (request.ContainsKey("Email") && request["Email"] != null)
130 account = m_UserAccountService.GetUserAccount(scopeID, request["Email"].ToString());
131
132 else if (request.ContainsKey("FirstName") && request.ContainsKey("LastName") &&
133 request["FirstName"] != null && request["LastName"] != null)
134 account = m_UserAccountService.GetUserAccount(scopeID, request["FirstName"].ToString(), request["LastName"].ToString());
135
136 if (account == null)
137 result["result"] = "null";
138 else
139 result["result"] = account.ToKeyValuePairs();
140
141 return ResultToBytes(result);
142 }
143
144 byte[] GetAccounts(Dictionary<string, object> request)
145 {
146 if (!request.ContainsKey("ScopeID") || !request.ContainsKey("query"))
147 return FailureResult();
148
149 UUID scopeID = UUID.Zero;
150 if (!UUID.TryParse(request["ScopeID"].ToString(), out scopeID))
151 return FailureResult();
152
153 string query = request["query"].ToString();
154
155 List<UserAccount> accounts = m_UserAccountService.GetUserAccounts(scopeID, query);
156
157 Dictionary<string, object> result = new Dictionary<string, object>();
158 if ((accounts == null) || ((accounts != null) && (accounts.Count == 0)))
159 result["result"] = "null";
160 else
161 {
162 int i = 0;
163 foreach (UserAccount acc in accounts)
164 {
165 Dictionary<string, object> rinfoDict = acc.ToKeyValuePairs();
166 result["account" + i] = rinfoDict;
167 i++;
168 }
169 }
170
171 string xmlString = ServerUtils.BuildXmlResponse(result);
172 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
173 UTF8Encoding encoding = new UTF8Encoding();
174 return encoding.GetBytes(xmlString);
175 }
176
177 byte[] CreateAccount(Dictionary<string, object> request)
178 {
179 if (!request.ContainsKey("account"))
180 return FailureResult();
181 if (request["account"] == null)
182 return FailureResult();
183 if (!(request["account"] is Dictionary<string, object>))
184 return FailureResult();
185
186 UserAccount account = new UserAccount((Dictionary<string, object>) request["account"]);
187
188 if (m_UserAccountService.CreateUserAccount(account))
189 return SuccessResult();
190
191 return FailureResult();
192 }
193
194 byte[] SetAccount(Dictionary<string, object> request)
195 {
196 if (!request.ContainsKey("account"))
197 return FailureResult();
198 if (request["account"] == null)
199 return FailureResult();
200 if (!(request["account"] is Dictionary<string, object>))
201 return FailureResult();
202
203 UserAccount account = new UserAccount((Dictionary<string, object>)request["account"]);
204
205 if (m_UserAccountService.SetUserAccount(account))
206 return SuccessResult();
207
208 return FailureResult();
209 }
210
211 private byte[] SuccessResult()
212 {
213 XmlDocument doc = new XmlDocument();
214
215 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
216 "", "");
217
218 doc.AppendChild(xmlnode);
219
220 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
221 "");
222
223 doc.AppendChild(rootElement);
224
225 XmlElement result = doc.CreateElement("", "result", "");
226 result.AppendChild(doc.CreateTextNode("Success"));
227
228 rootElement.AppendChild(result);
229
230 return DocToBytes(doc);
231 }
232
233 private byte[] FailureResult()
234 {
235 XmlDocument doc = new XmlDocument();
236
237 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
238 "", "");
239
240 doc.AppendChild(xmlnode);
241
242 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
243 "");
244
245 doc.AppendChild(rootElement);
246
247 XmlElement result = doc.CreateElement("", "result", "");
248 result.AppendChild(doc.CreateTextNode("Failure"));
249
250 rootElement.AppendChild(result);
251
252 return DocToBytes(doc);
253 }
254
255 private byte[] DocToBytes(XmlDocument doc)
256 {
257 MemoryStream ms = new MemoryStream();
258 XmlTextWriter xw = new XmlTextWriter(ms, null);
259 xw.Formatting = Formatting.Indented;
260 doc.WriteTo(xw);
261 xw.Flush();
262
263 return ms.ToArray();
264 }
265
266 private byte[] ResultToBytes(Dictionary<string, object> result)
267 {
268 string xmlString = ServerUtils.BuildXmlResponse(result);
269 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
270 UTF8Encoding encoding = new UTF8Encoding();
271 return encoding.GetBytes(xmlString);
272 }
273
274
275 }
276}
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 482862d..29cfd6e 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -109,9 +109,9 @@ namespace OpenSim.Services.Connectors
109 { 109 {
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
111 111
112 if (replyData.ContainsKey("Result")) 112 if (replyData.ContainsKey("result"))
113 { 113 {
114 if (replyData["Result"].ToString().ToLower() == "success") 114 if (replyData["result"].ToString().ToLower() == "success")
115 return true; 115 return true;
116 else 116 else
117 return false; 117 return false;
@@ -153,9 +153,9 @@ namespace OpenSim.Services.Connectors
153 { 153 {
154 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 154 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
155 155
156 if (replyData.ContainsKey("Result")) 156 if (replyData.ContainsKey("result"))
157 { 157 {
158 if (replyData["Result"].ToString().ToLower() == "success") 158 if (replyData["result"].ToString().ToLower() == "success")
159 return true; 159 return true;
160 else 160 else
161 return false; 161 return false;
@@ -196,9 +196,9 @@ namespace OpenSim.Services.Connectors
196 { 196 {
197 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 197 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
198 198
199 if (replyData.ContainsKey("Result")) 199 if (replyData.ContainsKey("result"))
200 { 200 {
201 if (replyData["Result"].ToString().ToLower() == "success") 201 if (replyData["result"].ToString().ToLower() == "success")
202 return true; 202 return true;
203 else 203 else
204 return false; 204 return false;
@@ -242,9 +242,9 @@ namespace OpenSim.Services.Connectors
242 { 242 {
243 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 243 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
244 244
245 if (replyData.ContainsKey("Result")) 245 if (replyData.ContainsKey("result"))
246 { 246 {
247 if (replyData["Result"].ToString().ToLower() == "success") 247 if (replyData["result"].ToString().ToLower() == "success")
248 return true; 248 return true;
249 else 249 else
250 return false; 250 return false;
@@ -296,11 +296,8 @@ namespace OpenSim.Services.Connectors
296 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 296 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
297 PresenceInfo pinfo = null; 297 PresenceInfo pinfo = null;
298 298
299 if ((replyData != null) && (replyData["result"] != null)) 299 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
300 { 300 {
301 if (replyData["result"].ToString() == "null")
302 return null;
303
304 if (replyData["result"] is Dictionary<string, object>) 301 if (replyData["result"] is Dictionary<string, object>)
305 { 302 {
306 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); 303 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
@@ -345,7 +342,8 @@ namespace OpenSim.Services.Connectors
345 342
346 if (replyData != null) 343 if (replyData != null)
347 { 344 {
348 if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null") 345 if (replyData.ContainsKey("result") &&
346 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
349 { 347 {
350 return new PresenceInfo[0]; 348 return new PresenceInfo[0];
351 } 349 }
@@ -395,9 +393,9 @@ namespace OpenSim.Services.Connectors
395 { 393 {
396 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 394 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
397 395
398 if (replyData.ContainsKey("Result")) 396 if (replyData.ContainsKey("result"))
399 { 397 {
400 if (replyData["Result"].ToString().ToLower() == "success") 398 if (replyData["result"].ToString().ToLower() == "success")
401 return true; 399 return true;
402 else 400 else
403 return false; 401 return false;
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserServiceConnector.cs
new file mode 100644
index 0000000..d4b906a
--- /dev/null
+++ b/OpenSim/Services/Connectors/UserAccounts/UserServiceConnector.cs
@@ -0,0 +1,287 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces;
39using OpenMetaverse;
40
41namespace OpenSim.Services.Connectors
42{
43 public class UserAccountServicesConnector : IUserAccountService
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType);
48
49 private string m_ServerURI = String.Empty;
50
51 public UserAccountServicesConnector()
52 {
53 }
54
55 public UserAccountServicesConnector(string serverURI)
56 {
57 m_ServerURI = serverURI.TrimEnd('/');
58 }
59
60 public UserAccountServicesConnector(IConfigSource source)
61 {
62 Initialise(source);
63 }
64
65 public virtual void Initialise(IConfigSource source)
66 {
67 IConfig assetConfig = source.Configs["UserAccountService"];
68 if (assetConfig == null)
69 {
70 m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini");
71 throw new Exception("User account connector init error");
72 }
73
74 string serviceURI = assetConfig.GetString("UserAccountServerURI",
75 String.Empty);
76
77 if (serviceURI == String.Empty)
78 {
79 m_log.Error("[ACCOUNT CONNECTOR]: No Server URI named in section UserAccountService");
80 throw new Exception("User account connector init error");
81 }
82 m_ServerURI = serviceURI;
83 }
84
85 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
86 {
87 Dictionary<string, object> sendData = new Dictionary<string, object>();
88 //sendData["SCOPEID"] = scopeID.ToString();
89 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
90 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
91 sendData["METHOD"] = "getaccount";
92
93 sendData["ScopeID"] = scopeID;
94 sendData["FirstName"] = firstName.ToString();
95 sendData["LastName"] = lastName.ToString();
96
97 return SendAndGetReply(sendData);
98 }
99
100 public UserAccount GetUserAccount(UUID scopeID, string email)
101 {
102 Dictionary<string, object> sendData = new Dictionary<string, object>();
103 //sendData["SCOPEID"] = scopeID.ToString();
104 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
105 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
106 sendData["METHOD"] = "getaccount";
107
108 sendData["ScopeID"] = scopeID;
109 sendData["Email"] = email;
110
111 return SendAndGetReply(sendData);
112 }
113
114 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
115 {
116 Dictionary<string, object> sendData = new Dictionary<string, object>();
117 //sendData["SCOPEID"] = scopeID.ToString();
118 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
119 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
120 sendData["METHOD"] = "getaccount";
121
122 sendData["ScopeID"] = scopeID;
123 sendData["UserID"] = userID.ToString();
124
125 return SendAndGetReply(sendData);
126 }
127
128 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
129 {
130 Dictionary<string, object> sendData = new Dictionary<string, object>();
131 //sendData["SCOPEID"] = scopeID.ToString();
132 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
133 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
134 sendData["METHOD"] = "getagents";
135
136 sendData["ScopeID"] = scopeID.ToString();
137 sendData["query"] = query;
138
139 string reply = string.Empty;
140 string reqString = ServerUtils.BuildQueryString(sendData);
141 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
142 try
143 {
144 reply = SynchronousRestFormsRequester.MakeRequest("POST",
145 m_ServerURI + "/accounts",
146 reqString);
147 if (reply == null || (reply != null && reply == string.Empty))
148 {
149 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply");
150 return null;
151 }
152 }
153 catch (Exception e)
154 {
155 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting accounts server: {0}", e.Message);
156 }
157
158 List<UserAccount> accounts = new List<UserAccount>();
159
160 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
161
162 if (replyData != null)
163 {
164 if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null")
165 {
166 return accounts;
167 }
168
169 Dictionary<string, object>.ValueCollection accountList = replyData.Values;
170 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
171 foreach (object acc in accountList)
172 {
173 if (acc is Dictionary<string, object>)
174 {
175 UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc);
176 accounts.Add(pinfo);
177 }
178 else
179 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received invalid response type {0}",
180 acc.GetType());
181 }
182 }
183 else
184 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccounts received null response");
185
186 return accounts;
187 }
188
189 public bool SetUserAccount(UserAccount data)
190 {
191 Dictionary<string, object> sendData = new Dictionary<string, object>();
192 //sendData["SCOPEID"] = scopeID.ToString();
193 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
194 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
195 sendData["METHOD"] = "setaccount";
196
197 sendData["account"] = data.ToKeyValuePairs();
198
199 return SendAndGetBoolReply(sendData);
200 }
201
202 public bool CreateUserAccount(UserAccount data)
203 {
204 Dictionary<string, object> sendData = new Dictionary<string, object>();
205 //sendData["SCOPEID"] = scopeID.ToString();
206 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
207 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
208 sendData["METHOD"] = "createaccount";
209
210 sendData["account"] = data.ToKeyValuePairs();
211
212 return SendAndGetBoolReply(sendData);
213 }
214
215 private UserAccount SendAndGetReply(Dictionary<string, object> sendData)
216 {
217 string reply = string.Empty;
218 string reqString = ServerUtils.BuildQueryString(sendData);
219 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
220 try
221 {
222 reply = SynchronousRestFormsRequester.MakeRequest("POST",
223 m_ServerURI + "/accounts",
224 reqString);
225 if (reply == null || (reply != null && reply == string.Empty))
226 {
227 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply");
228 return null;
229 }
230 }
231 catch (Exception e)
232 {
233 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user account server: {0}", e.Message);
234 }
235
236 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
237 UserAccount account = null;
238
239 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
240 {
241 if (replyData["result"] is Dictionary<string, object>)
242 {
243 account = new UserAccount((Dictionary<string, object>)replyData["result"]);
244 }
245 }
246
247 return account;
248
249 }
250
251 private bool SendAndGetBoolReply(Dictionary<string, object> sendData)
252 {
253 string reqString = ServerUtils.BuildQueryString(sendData);
254 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
255 try
256 {
257 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
258 m_ServerURI + "/accounts",
259 reqString);
260 if (reply != string.Empty)
261 {
262 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
263
264 if (replyData.ContainsKey("result"))
265 {
266 if (replyData["result"].ToString().ToLower() == "success")
267 return true;
268 else
269 return false;
270 }
271 else
272 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount reply data does not contain result field");
273
274 }
275 else
276 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount received empty reply");
277 }
278 catch (Exception e)
279 {
280 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Exception when contacting user account server: {0}", e.Message);
281 }
282
283 return false;
284 }
285
286 }
287}
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs
index 1089c6c..e4e4bec 100644
--- a/OpenSim/Services/Interfaces/IUserService.cs
+++ b/OpenSim/Services/Interfaces/IUserService.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Services.Interfaces
48 public UUID UserID; 48 public UUID UserID;
49 public UUID ScopeID; 49 public UUID ScopeID;
50 50
51 public Dictionary<string, string> ServiceURLs; 51 public Dictionary<string, object> ServiceURLs;
52 52
53 public DateTime Created; 53 public DateTime Created;
54 54
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
67 if (kvp.ContainsKey("Created")) 67 if (kvp.ContainsKey("Created"))
68 DateTime.TryParse(kvp["Created"].ToString(), out Created); 68 DateTime.TryParse(kvp["Created"].ToString(), out Created);
69 if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null && (kvp["ServiceURLs"] is Dictionary<string, string>)) 69 if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null && (kvp["ServiceURLs"] is Dictionary<string, string>))
70 ServiceURLs = (Dictionary<string, string>)kvp["ServiceURLs"]; 70 ServiceURLs = (Dictionary<string, object>)kvp["ServiceURLs"];
71 } 71 }
72 72
73 public Dictionary<string, object> ToKeyValuePairs() 73 public Dictionary<string, object> ToKeyValuePairs()