aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs193
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs25
-rw-r--r--OpenSim/Services/Interfaces/IBansService.cs48
-rw-r--r--OpenSim/Services/Interfaces/IUserProfilesService.cs75
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs20
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs7
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs2
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs187
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs86
9 files changed, 526 insertions, 117 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 854bea4..7bb06fb 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -137,10 +137,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
137 userID, sessionID, secureSessionID); 137 userID, sessionID, secureSessionID);
138 138
139 NameValueCollection requestArgs = new NameValueCollection 139 NameValueCollection requestArgs = new NameValueCollection
140 { 140 {
141 { "RequestMethod", "AddSession" }, 141 { "RequestMethod", "AddSession" },
142 { "UserID", userID.ToString() } 142 { "UserID", userID.ToString() }
143 }; 143 };
144
144 if (sessionID != UUID.Zero) 145 if (sessionID != UUID.Zero)
145 { 146 {
146 requestArgs["SessionID"] = sessionID.ToString(); 147 requestArgs["SessionID"] = sessionID.ToString();
@@ -158,13 +159,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
158 159
159 public bool LogoutAgent(UUID sessionID) 160 public bool LogoutAgent(UUID sessionID)
160 { 161 {
161// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); 162 // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID);
162 163
163 NameValueCollection requestArgs = new NameValueCollection 164 NameValueCollection requestArgs = new NameValueCollection
164 { 165 {
165 { "RequestMethod", "RemoveSession" }, 166 { "RequestMethod", "RemoveSession" },
166 { "SessionID", sessionID.ToString() } 167 { "SessionID", sessionID.ToString() }
167 }; 168 };
168 169
169 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 170 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
170 bool success = response["Success"].AsBoolean(); 171 bool success = response["Success"].AsBoolean();
@@ -177,13 +178,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
177 178
178 public bool LogoutRegionAgents(UUID regionID) 179 public bool LogoutRegionAgents(UUID regionID)
179 { 180 {
180// m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); 181 // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID);
181 182
182 NameValueCollection requestArgs = new NameValueCollection 183 NameValueCollection requestArgs = new NameValueCollection
183 { 184 {
184 { "RequestMethod", "RemoveSessions" }, 185 { "RequestMethod", "RemoveSessions" },
185 { "SceneID", regionID.ToString() } 186 { "SceneID", regionID.ToString() }
186 }; 187 };
187 188
188 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 189 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
189 bool success = response["Success"].AsBoolean(); 190 bool success = response["Success"].AsBoolean();
@@ -202,49 +203,46 @@ namespace OpenSim.Services.Connectors.SimianGrid
202 203
203 public PresenceInfo GetAgent(UUID sessionID) 204 public PresenceInfo GetAgent(UUID sessionID)
204 { 205 {
205// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); 206 OSDMap sessionResponse = GetSessionDataFromSessionID(sessionID);
206 207 if (sessionResponse == null)
207 NameValueCollection requestArgs = new NameValueCollection
208 {
209 { "RequestMethod", "GetSession" },
210 { "SessionID", sessionID.ToString() }
211 };
212
213 OSDMap sessionResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
214 if (sessionResponse["Success"].AsBoolean())
215 { 208 {
216 UUID userID = sessionResponse["UserID"].AsUUID(); 209 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session {0}: {1}",sessionID.ToString(),sessionResponse["Message"].AsString());
217 m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); 210 return null;
218
219 requestArgs = new NameValueCollection
220 {
221 { "RequestMethod", "GetUser" },
222 { "UserID", userID.ToString() }
223 };
224
225 OSDMap userResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
226 if (userResponse["Success"].AsBoolean())
227 return ResponseToPresenceInfo(sessionResponse, userResponse);
228 else
229 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString());
230 } 211 }
231 else 212
213 UUID userID = sessionResponse["UserID"].AsUUID();
214 OSDMap userResponse = GetUserData(userID);
215 if (userResponse == null)
232 { 216 {
233 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString()); 217 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID.ToString(),userResponse["Message"].AsString());
218 return null;
234 } 219 }
235 220
236 return null; 221 return ResponseToPresenceInfo(sessionResponse);
237 } 222 }
238 223
239 public PresenceInfo[] GetAgents(string[] userIDs) 224 public PresenceInfo[] GetAgents(string[] userIDs)
240 { 225 {
241 List<PresenceInfo> presences = new List<PresenceInfo>(userIDs.Length); 226 List<PresenceInfo> presences = new List<PresenceInfo>();
242 227
243 for (int i = 0; i < userIDs.Length; i++) 228 NameValueCollection requestArgs = new NameValueCollection
229 {
230 { "RequestMethod", "GetSessions" },
231 { "UserIDList", String.Join(",",userIDs) }
232 };
233
234 OSDMap sessionListResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
235 if (! sessionListResponse["Success"].AsBoolean())
244 { 236 {
245 UUID userID; 237 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString());
246 if (UUID.TryParse(userIDs[i], out userID) && userID != UUID.Zero) 238 return null;
247 presences.AddRange(GetSessions(userID)); 239 }
240
241 OSDArray sessionList = sessionListResponse["Sessions"] as OSDArray;
242 for (int i = 0; i < sessionList.Count; i++)
243 {
244 OSDMap sessionInfo = sessionList[i] as OSDMap;
245 presences.Add(ResponseToPresenceInfo(sessionInfo));
248 } 246 }
249 247
250 return presences.ToArray(); 248 return presences.ToArray();
@@ -262,7 +260,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
262 260
263 public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) 261 public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
264 { 262 {
265// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID); 263 // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
266 264
267 // Remove the session to mark this user offline 265 // Remove the session to mark this user offline
268 if (!LogoutAgent(sessionID)) 266 if (!LogoutAgent(sessionID))
@@ -270,11 +268,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
270 268
271 // Save our last position as user data 269 // Save our last position as user data
272 NameValueCollection requestArgs = new NameValueCollection 270 NameValueCollection requestArgs = new NameValueCollection
273 { 271 {
274 { "RequestMethod", "AddUserData" }, 272 { "RequestMethod", "AddUserData" },
275 { "UserID", userID.ToString() }, 273 { "UserID", userID.ToString() },
276 { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } 274 { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) }
277 }; 275 };
278 276
279 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 277 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
280 bool success = response["Success"].AsBoolean(); 278 bool success = response["Success"].AsBoolean();
@@ -287,14 +285,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
287 285
288 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) 286 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
289 { 287 {
290// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID); 288 // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID);
291 289
292 NameValueCollection requestArgs = new NameValueCollection 290 NameValueCollection requestArgs = new NameValueCollection
293 { 291 {
294 { "RequestMethod", "AddUserData" }, 292 { "RequestMethod", "AddUserData" },
295 { "UserID", userID.ToString() }, 293 { "UserID", userID.ToString() },
296 { "HomeLocation", SerializeLocation(regionID, position, lookAt) } 294 { "HomeLocation", SerializeLocation(regionID, position, lookAt) }
297 }; 295 };
298 296
299 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 297 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
300 bool success = response["Success"].AsBoolean(); 298 bool success = response["Success"].AsBoolean();
@@ -312,23 +310,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
312 310
313 public GridUserInfo GetGridUserInfo(string user) 311 public GridUserInfo GetGridUserInfo(string user)
314 { 312 {
315// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); 313 // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
316 314
317 UUID userID = new UUID(user); 315 UUID userID = new UUID(user);
318// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); 316 OSDMap userResponse = GetUserData(userID);
319 317 if (userResponse != null)
320 NameValueCollection requestArgs = new NameValueCollection
321 {
322 { "RequestMethod", "GetUser" },
323 { "UserID", userID.ToString() }
324 };
325
326 OSDMap userResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
327 if (userResponse["Success"].AsBoolean())
328 return ResponseToGridUserInfo(userResponse); 318 return ResponseToGridUserInfo(userResponse);
329 else
330 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString());
331 319
320 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID,userResponse["Message"].AsString());
332 return null; 321 return null;
333 } 322 }
334 323
@@ -338,65 +327,49 @@ namespace OpenSim.Services.Connectors.SimianGrid
338 327
339 private OSDMap GetUserData(UUID userID) 328 private OSDMap GetUserData(UUID userID)
340 { 329 {
341// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); 330 // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID);
342 331
343 NameValueCollection requestArgs = new NameValueCollection 332 NameValueCollection requestArgs = new NameValueCollection
344 { 333 {
345 { "RequestMethod", "GetUser" }, 334 { "RequestMethod", "GetUser" },
346 { "UserID", userID.ToString() } 335 { "UserID", userID.ToString() }
347 }; 336 };
348 337
349 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 338 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
350 if (response["Success"].AsBoolean() && response["User"] is OSDMap) 339 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
351 return response; 340 return response;
352 else
353 m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString());
354 341
342 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}; {1}",userID.ToString(),response["Message"].AsString());
355 return null; 343 return null;
356 } 344 }
357 345
358 private List<PresenceInfo> GetSessions(UUID userID) 346 private OSDMap GetSessionDataFromSessionID(UUID sessionID)
359 { 347 {
360 List<PresenceInfo> presences = new List<PresenceInfo>(1); 348 NameValueCollection requestArgs = new NameValueCollection
361
362 OSDMap userResponse = GetUserData(userID);
363 if (userResponse != null)
364 {
365// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID);
366
367 NameValueCollection requestArgs = new NameValueCollection
368 { 349 {
369 { "RequestMethod", "GetSession" }, 350 { "RequestMethod", "GetSession" },
370 { "UserID", userID.ToString() } 351 { "SessionID", sessionID.ToString() }
371 }; 352 };
372 353
373 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 354 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
374 if (response["Success"].AsBoolean()) 355 if (response["Success"].AsBoolean())
375 { 356 return response;
376 PresenceInfo presence = ResponseToPresenceInfo(response, userResponse);
377 if (presence != null)
378 presences.Add(presence);
379 }
380// else
381// {
382// m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString());
383// }
384 }
385 357
386 return presences; 358 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for {0}; {1}",sessionID.ToString(),response["Message"].AsString());
359 return null;
387 } 360 }
388 361
389 private bool UpdateSession(UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) 362 private bool UpdateSession(UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
390 { 363 {
391 // Save our current location as session data 364 // Save our current location as session data
392 NameValueCollection requestArgs = new NameValueCollection 365 NameValueCollection requestArgs = new NameValueCollection
393 { 366 {
394 { "RequestMethod", "UpdateSession" }, 367 { "RequestMethod", "UpdateSession" },
395 { "SessionID", sessionID.ToString() }, 368 { "SessionID", sessionID.ToString() },
396 { "SceneID", regionID.ToString() }, 369 { "SceneID", regionID.ToString() },
397 { "ScenePosition", lastPosition.ToString() }, 370 { "ScenePosition", lastPosition.ToString() },
398 { "SceneLookAt", lastLookAt.ToString() } 371 { "SceneLookAt", lastLookAt.ToString() }
399 }; 372 };
400 373
401 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 374 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
402 bool success = response["Success"].AsBoolean(); 375 bool success = response["Success"].AsBoolean();
@@ -407,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
407 return success; 380 return success;
408 } 381 }
409 382
410 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) 383 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse)
411 { 384 {
412 if (sessionResponse == null) 385 if (sessionResponse == null)
413 return null; 386 return null;
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 97a0afc..0cf1c14 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Services.HypergridService
58 private static IUserAgentService m_UserAgentService; 58 private static IUserAgentService m_UserAgentService;
59 private static ISimulationService m_SimulationService; 59 private static ISimulationService m_SimulationService;
60 private static IGridUserService m_GridUserService; 60 private static IGridUserService m_GridUserService;
61 private static IBansService m_BansService;
61 62
62 private static string m_AllowedClients = string.Empty; 63 private static string m_AllowedClients = string.Empty;
63 private static string m_DeniedClients = string.Empty; 64 private static string m_DeniedClients = string.Empty;
@@ -87,6 +88,7 @@ namespace OpenSim.Services.HypergridService
87 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 88 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
88 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 89 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
89 string gridUserService = serverConfig.GetString("GridUserService", String.Empty); 90 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
91 string bansService = serverConfig.GetString("BansService", String.Empty);
90 92
91 // These are mandatory, the others aren't 93 // These are mandatory, the others aren't
92 if (gridService == string.Empty || presenceService == string.Empty) 94 if (gridService == string.Empty || presenceService == string.Empty)
@@ -121,6 +123,8 @@ namespace OpenSim.Services.HypergridService
121 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 123 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
122 if (gridUserService != string.Empty) 124 if (gridUserService != string.Empty)
123 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 125 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
126 if (bansService != string.Empty)
127 m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args);
124 128
125 if (simService != null) 129 if (simService != null)
126 m_SimulationService = simService; 130 m_SimulationService = simService;
@@ -223,7 +227,7 @@ namespace OpenSim.Services.HypergridService
223 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}", 227 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}",
224 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, 228 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName,
225 aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); 229 aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString());
226 230
227 // 231 //
228 // Check client 232 // Check client
229 // 233 //
@@ -287,17 +291,16 @@ namespace OpenSim.Services.HypergridService
287 } 291 }
288 } 292 }
289 } 293 }
290 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok");
291 294
292 // 295 //
293 // Foreign agents allowed? Exceptions? 296 // Foreign agents allowed? Exceptions?
294 // 297 //
295 if (account == null) 298 if (account == null)
296 { 299 {
297 bool allowed = m_ForeignAgentsAllowed; 300 bool allowed = m_ForeignAgentsAllowed;
298 301
299 if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) 302 if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions))
300 allowed = false; 303 allowed = false;
301 304
302 if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) 305 if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
303 allowed = true; 306 allowed = true;
@@ -311,6 +314,20 @@ namespace OpenSim.Services.HypergridService
311 } 314 }
312 } 315 }
313 316
317 //
318 // Is the user banned?
319 // This uses a Ban service that's more powerful than the configs
320 //
321 string uui = (account != null ? aCircuit.AgentID.ToString() : Util.ProduceUserUniversalIdentifier(aCircuit));
322 if (m_BansService != null && m_BansService.IsBanned(uui, aCircuit.IPAddress, aCircuit.Id0, authURL))
323 {
324 reason = "You are banned from this world";
325 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: user {0} is banned", uui);
326 return false;
327 }
328
329 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK");
330
314 bool isFirstLogin = false; 331 bool isFirstLogin = false;
315 // 332 //
316 // Login the presence, if it's not there yet (by the login service) 333 // Login the presence, if it's not there yet (by the login service)
diff --git a/OpenSim/Services/Interfaces/IBansService.cs b/OpenSim/Services/Interfaces/IBansService.cs
new file mode 100644
index 0000000..8fd3521
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IBansService.cs
@@ -0,0 +1,48 @@
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 */
27using System;
28using System.Collections.Generic;
29
30using OpenSim.Framework;
31using OpenMetaverse;
32
33namespace OpenSim.Services.Interfaces
34{
35 public interface IBansService
36 {
37 /// <summary>
38 /// Are any of the given arguments banned from the grid?
39 /// </summary>
40 /// <param name="userID"></param>
41 /// <param name="ip"></param>
42 /// <param name="id0"></param>
43 /// <param name="origin"></param>
44 /// <returns></returns>
45 bool IsBanned(string userID, string ip, string id0, string origin);
46 }
47
48}
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs
new file mode 100644
index 0000000..319d307
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs
@@ -0,0 +1,75 @@
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 OpenSim.Framework;
30using OpenMetaverse;
31using OpenMetaverse.StructuredData;
32
33namespace OpenSim.Services.Interfaces
34{
35 public interface IUserProfilesService
36 {
37 #region Classifieds
38 OSD AvatarClassifiedsRequest(UUID creatorId);
39 bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result);
40 bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result);
41 bool ClassifiedDelete(UUID recordId);
42 #endregion Classifieds
43
44 #region Picks
45 OSD AvatarPicksRequest(UUID creatorId);
46 bool PickInfoRequest(ref UserProfilePick pick, ref string result);
47 bool PicksUpdate(ref UserProfilePick pick, ref string result);
48 bool PicksDelete(UUID pickId);
49 #endregion Picks
50
51 #region Notes
52 bool AvatarNotesRequest(ref UserProfileNotes note);
53 bool NotesUpdate(ref UserProfileNotes note, ref string result);
54 #endregion Notes
55
56 #region Profile Properties
57 bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result);
58 bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result);
59 #endregion Profile Properties
60
61 #region Interests
62 bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result);
63 #endregion Interests
64
65 #region Utility
66 OSD AvatarImageAssetsRequest(UUID avatarId);
67 #endregion Utility
68
69 #region UserData
70 bool RequestUserAppData(ref UserAppData prop, ref string result);
71 bool SetUserAppData(UserAppData prop, ref string result);
72 #endregion UserData
73 }
74}
75
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index e2f947c..da6c016 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -233,7 +233,7 @@ namespace OpenSim.Services.LLLoginService
233 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 233 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
234 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 234 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
235 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, 235 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency,
236 string DSTZone, UUID realID) 236 string DSTZone, string destinationsURL, string avatarsURL, UUID realID)
237 : this() 237 : this()
238 { 238 {
239 FillOutInventoryData(invSkel, libService); 239 FillOutInventoryData(invSkel, libService);
@@ -253,6 +253,8 @@ namespace OpenSim.Services.LLLoginService
253 MapTileURL = mapTileURL; 253 MapTileURL = mapTileURL;
254 ProfileURL = profileURL; 254 ProfileURL = profileURL;
255 OpenIDURL = openIDURL; 255 OpenIDURL = openIDURL;
256 DestinationsURL = destinationsURL;
257 AvatarsURL = avatarsURL;
256 258
257 SearchURL = searchURL; 259 SearchURL = searchURL;
258 Currency = currency; 260 Currency = currency;
@@ -543,6 +545,12 @@ namespace OpenSim.Services.LLLoginService
543 if (profileURL != String.Empty) 545 if (profileURL != String.Empty)
544 responseData["profile-server-url"] = profileURL; 546 responseData["profile-server-url"] = profileURL;
545 547
548 if (DestinationsURL != String.Empty)
549 responseData["destination_guide_url"] = DestinationsURL;
550
551 if (AvatarsURL != String.Empty)
552 responseData["avatar_picker_url"] = AvatarsURL;
553
546 // We need to send an openid_token back in the response too 554 // We need to send an openid_token back in the response too
547 if (openIDURL != String.Empty) 555 if (openIDURL != String.Empty)
548 responseData["openid_url"] = openIDURL; 556 responseData["openid_url"] = openIDURL;
@@ -1073,6 +1081,16 @@ namespace OpenSim.Services.LLLoginService
1073 set { currency = value; } 1081 set { currency = value; }
1074 } 1082 }
1075 1083
1084 public string DestinationsURL
1085 {
1086 get; set;
1087 }
1088
1089 public string AvatarsURL
1090 {
1091 get; set;
1092 }
1093
1076 #endregion 1094 #endregion
1077 1095
1078 public class UserInfo 1096 public class UserInfo
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index ede2353..351c1ac 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -78,6 +78,8 @@ namespace OpenSim.Services.LLLoginService
78 protected string m_OpenIDURL; 78 protected string m_OpenIDURL;
79 protected string m_SearchURL; 79 protected string m_SearchURL;
80 protected string m_Currency; 80 protected string m_Currency;
81 protected string m_DestinationGuide;
82 protected string m_AvatarPicker;
81 83
82 protected string m_AllowedClients; 84 protected string m_AllowedClients;
83 protected string m_DeniedClients; 85 protected string m_DeniedClients;
@@ -117,6 +119,8 @@ namespace OpenSim.Services.LLLoginService
117 m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); 119 m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
118 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 120 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
119 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); 121 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
122 m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty);
123 m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty);
120 124
121 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); 125 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
122 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); 126 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
@@ -461,7 +465,8 @@ namespace OpenSim.Services.LLLoginService
461 = new LLLoginResponse( 465 = new LLLoginResponse(
462 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 466 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
463 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, 467 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP,
464 m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, realID); 468 m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone,
469 m_DestinationGuide, m_AvatarPicker, realID);
465 470
466 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); 471 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName);
467 472
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index 43fa04b..8388180 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Services.UserAccountService
73 return info; 73 return info;
74 } 74 }
75 75
76 public GridUserInfo[] GetGridUserInfo(string[] userIDs) 76 public virtual GridUserInfo[] GetGridUserInfo(string[] userIDs)
77 { 77 {
78 List<GridUserInfo> ret = new List<GridUserInfo>(); 78 List<GridUserInfo> ret = new List<GridUserInfo>();
79 79
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..d00f34d
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,187 @@
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.Reflection;
30using System.Text;
31using Nini.Config;
32using log4net;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Services.UserAccountService;
36using OpenSim.Data;
37using OpenMetaverse;
38using OpenMetaverse.StructuredData;
39using OpenSim.Framework;
40
41namespace OpenSim.Services.ProfilesService
42{
43 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
44 {
45 static readonly ILog m_log =
46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType);
48
49 IUserAccountService userAccounts;
50 IAuthenticationService authService;
51
52 public UserProfilesService(IConfigSource config, string configName):
53 base(config, configName)
54 {
55 IConfig Config = config.Configs[configName];
56 if (Config == null)
57 {
58 m_log.Warn("[PROFILES]: No configuration found!");
59 return;
60 }
61 Object[] args = null;
62
63 args = new Object[] { config };
64 string accountService = Config.GetString("UserAccountService", String.Empty);
65 if (accountService != string.Empty)
66 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
67
68 args = new Object[] { config };
69 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
70 if (accountService != string.Empty)
71 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
72 }
73
74 #region Classifieds
75 public OSD AvatarClassifiedsRequest(UUID creatorId)
76 {
77 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
78
79 return records;
80 }
81
82 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
83 {
84 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
85 {
86 return false;
87 }
88 result = "success";
89 return true;
90 }
91
92 public bool ClassifiedDelete(UUID recordId)
93 {
94 if(ProfilesData.DeleteClassifiedRecord(recordId))
95 return true;
96
97 return false;
98 }
99
100 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
101 {
102 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
103 return true;
104
105 return false;
106 }
107 #endregion Classifieds
108
109 #region Picks
110 public OSD AvatarPicksRequest(UUID creatorId)
111 {
112 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
113
114 return records;
115 }
116
117 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
118 {
119 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
120 result = "OK";
121 return true;
122 }
123
124 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
125 {
126 return ProfilesData.UpdatePicksRecord(pick);
127 }
128
129 public bool PicksDelete(UUID pickId)
130 {
131 return ProfilesData.DeletePicksRecord(pickId);
132 }
133 #endregion Picks
134
135 #region Notes
136 public bool AvatarNotesRequest(ref UserProfileNotes note)
137 {
138 return ProfilesData.GetAvatarNotes(ref note);
139 }
140
141 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
142 {
143 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
144 }
145 #endregion Notes
146
147 #region Profile Properties
148 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
149 {
150 return ProfilesData.GetAvatarProperties(ref prop, ref result);
151 }
152
153 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
154 {
155 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
156 }
157 #endregion Profile Properties
158
159 #region Interests
160 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
161 {
162 return ProfilesData.UpdateAvatarInterests(prop, ref result);
163 }
164 #endregion Interests
165
166 #region Utility
167 public OSD AvatarImageAssetsRequest(UUID avatarId)
168 {
169 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
170 return records;
171 }
172 #endregion Utility
173
174 #region UserData
175 public bool RequestUserAppData(ref UserAppData prop, ref string result)
176 {
177 return ProfilesData.GetUserAppData(ref prop, ref result);
178 }
179
180 public bool SetUserAppData(UserAppData prop, ref string result)
181 {
182 return true;
183 }
184 #endregion UserData
185 }
186}
187
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
new file mode 100644
index 0000000..927f7c9
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
@@ -0,0 +1,86 @@
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.Reflection;
30using Nini.Config;
31using log4net;
32using OpenSim.Services.Base;
33using OpenSim.Data;
34
35namespace OpenSim.Services.ProfilesService
36{
37 public class UserProfilesServiceBase: ServiceBase
38 {
39 static readonly ILog m_log =
40 LogManager.GetLogger(
41 MethodBase.GetCurrentMethod().DeclaringType);
42
43 public IProfilesData ProfilesData;
44
45 public string ConfigName
46 {
47 get; private set;
48 }
49
50 public UserProfilesServiceBase(IConfigSource config, string configName):
51 base(config)
52 {
53 if(string.IsNullOrEmpty(configName))
54 {
55 m_log.WarnFormat("[PROFILES]: Configuration section not given!");
56 return;
57 }
58
59 string dllName = String.Empty;
60 string connString = null;
61 string realm = String.Empty;
62
63 IConfig dbConfig = config.Configs["DatabaseService"];
64 if (dbConfig != null)
65 {
66 if (dllName == String.Empty)
67 dllName = dbConfig.GetString("StorageProvider", String.Empty);
68 if (string.IsNullOrEmpty(connString))
69 connString = dbConfig.GetString("ConnectionString", String.Empty);
70 }
71
72 IConfig ProfilesConfig = config.Configs[configName];
73 if (ProfilesConfig != null)
74 {
75 connString = ProfilesConfig.GetString("ConnectionString", connString);
76 realm = ProfilesConfig.GetString("Realm", realm);
77 }
78
79 ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString });
80 if (ProfilesData == null)
81 throw new Exception("Could not find a storage interface in the given module");
82
83 }
84 }
85}
86