aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs15
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs115
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs97
3 files changed, 163 insertions, 64 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 851b7b4..c7a259d 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -84,11 +84,20 @@ namespace OpenSim.Services.AssetService
84 if (assetLoaderEnabled) 84 if (assetLoaderEnabled)
85 { 85 {
86 m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); 86 m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
87 m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, 87
88 delegate(AssetBase a) 88 m_AssetLoader.ForEachDefaultXmlAsset(
89 loaderArgs,
90 delegate(AssetBase a)
91 {
92 AssetBase existingAsset = Get(a.ID);
93// AssetMetadata existingMetadata = GetMetadata(a.ID);
94
95 if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data))
89 { 96 {
97// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID);
90 Store(a); 98 Store(a);
91 }); 99 }
100 });
92 } 101 }
93 102
94 m_log.Info("[ASSET SERVICE]: Local asset service enabled"); 103 m_log.Info("[ASSET SERVICE]: Local asset service enabled");
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 5262598..83ec122 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
63 protected GatekeeperServiceConnector m_GatekeeperConnector; 63 protected GatekeeperServiceConnector m_GatekeeperConnector;
64 64
65 protected UUID m_ScopeID = UUID.Zero; 65 protected UUID m_ScopeID = UUID.Zero;
66 protected bool m_Check4096 = true; 66// protected bool m_Check4096 = true;
67 protected string m_MapTileDirectory = string.Empty; 67 protected string m_MapTileDirectory = string.Empty;
68 protected string m_ThisGatekeeper = string.Empty; 68 protected string m_ThisGatekeeper = string.Empty;
69 protected Uri m_ThisGatekeeperURI = null; 69 protected Uri m_ThisGatekeeperURI = null;
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
121 if (scope != string.Empty) 121 if (scope != string.Empty)
122 UUID.TryParse(scope, out m_ScopeID); 122 UUID.TryParse(scope, out m_ScopeID);
123 123
124 m_Check4096 = gridConfig.GetBoolean("Check4096", true); 124// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
125 125
126 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); 126 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
127 127
@@ -347,14 +347,18 @@ namespace OpenSim.Services.GridService
347 return true; 347 return true;
348 } 348 }
349 349
350 uint x, y; 350 // We are now performing this check for each individual teleport in the EntityTransferModule instead. This
351 if (m_Check4096 && !Check4096(handle, out x, out y)) 351 // allows us to give better feedback when teleports fail because of the distance reason (which can't be
352 { 352 // done here) and it also hypergrid teleports that are within range (possibly because the source grid
353 RemoveHyperlinkRegion(regInfo.RegionID); 353 // itself has regions that are very far apart).
354 reason = "Region is too far (" + x + ", " + y + ")"; 354// uint x, y;
355 m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); 355// if (m_Check4096 && !Check4096(handle, out x, out y))
356 return false; 356// {
357 } 357// //RemoveHyperlinkRegion(regInfo.RegionID);
358// reason = "Region is too far (" + x + ", " + y + ")";
359// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
360// //return false;
361// }
358 362
359 regInfo.RegionID = regionID; 363 regInfo.RegionID = regionID;
360 364
@@ -405,60 +409,59 @@ namespace OpenSim.Services.GridService
405 } 409 }
406 } 410 }
407 411
408 /// <summary> 412// Not currently used
409 /// Cope with this viewer limitation. 413// /// <summary>
410 /// </summary> 414// /// Cope with this viewer limitation.
411 /// <param name="regInfo"></param> 415// /// </summary>
412 /// <returns></returns> 416// /// <param name="regInfo"></param>
413 public bool Check4096(ulong realHandle, out uint x, out uint y) 417// /// <returns></returns>
414 { 418// public bool Check4096(ulong realHandle, out uint x, out uint y)
415 uint ux = 0, uy = 0; 419// {
416 Utils.LongToUInts(realHandle, out ux, out uy); 420// uint ux = 0, uy = 0;
417 x = ux / Constants.RegionSize; 421// Utils.LongToUInts(realHandle, out ux, out uy);
418 y = uy / Constants.RegionSize; 422// x = ux / Constants.RegionSize;
419 423// y = uy / Constants.RegionSize;
420 const uint limit = (4096 - 1) * Constants.RegionSize; 424//
421 uint xmin = ux - limit; 425// const uint limit = (4096 - 1) * Constants.RegionSize;
422 uint xmax = ux + limit; 426// uint xmin = ux - limit;
423 uint ymin = uy - limit; 427// uint xmax = ux + limit;
424 uint ymax = uy + limit; 428// uint ymin = uy - limit;
425 // World map boundary checks 429// uint ymax = uy + limit;
426 if (xmin < 0 || xmin > ux) 430// // World map boundary checks
427 xmin = 0; 431// if (xmin < 0 || xmin > ux)
428 if (xmax > int.MaxValue || xmax < ux) 432// xmin = 0;
429 xmax = int.MaxValue; 433// if (xmax > int.MaxValue || xmax < ux)
430 if (ymin < 0 || ymin > uy) 434// xmax = int.MaxValue;
431 ymin = 0; 435// if (ymin < 0 || ymin > uy)
432 if (ymax > int.MaxValue || ymax < uy) 436// ymin = 0;
433 ymax = int.MaxValue; 437// if (ymax > int.MaxValue || ymax < uy)
434 438// ymax = int.MaxValue;
435 // Check for any regions that are within the possible teleport range to the linked region 439//
436 List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); 440// // Check for any regions that are within the possible teleport range to the linked region
437 if (regions.Count == 0) 441// List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
438 { 442// if (regions.Count == 0)
439 return false; 443// {
440 } 444// return false;
441 else 445// }
442 { 446// else
443 // Check for regions which are not linked regions 447// {
444 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 448// // Check for regions which are not linked regions
445 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 449// List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
446 if (availableRegions.Count() == 0) 450// IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
447 return false; 451// if (availableRegions.Count() == 0)
448 } 452// return false;
449 453// }
450 return true; 454//
451 } 455// return true;
456// }
452 457
453 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 458 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
454 { 459 {
455
456 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); 460 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
457 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; 461 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
458 rdata.Data["flags"] = flags.ToString(); 462 rdata.Data["flags"] = flags.ToString();
459 463
460 m_Database.Store(rdata); 464 m_Database.Store(rdata);
461
462 } 465 }
463 466
464 private void RemoveHyperlinkRegion(UUID regionID) 467 private void RemoveHyperlinkRegion(UUID regionID)
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index f376cf8..8b8a8f9 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -83,9 +83,24 @@ namespace OpenSim.Services.UserAccountService
83 "create user", 83 "create user",
84 "create user [<first> [<last> [<pass> [<email>]]]]", 84 "create user [<first> [<last> [<pass> [<email>]]]]",
85 "Create a new user", HandleCreateUser); 85 "Create a new user", HandleCreateUser);
86 MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password", 86
87 MainConsole.Instance.Commands.AddCommand("UserService", false,
88 "reset user password",
87 "reset user password [<first> [<last> [<password>]]]", 89 "reset user password [<first> [<last> [<password>]]]",
88 "Reset a user password", HandleResetUserPassword); 90 "Reset a user password", HandleResetUserPassword);
91
92 MainConsole.Instance.Commands.AddCommand("UserService", false,
93 "set user level",
94 "set user level [<first> [<last> [<level>]]]",
95 "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
96 + "this account will be treated as god-moded. "
97 + "It will also affect the 'login level' command. ",
98 HandleSetUserLevel);
99
100 MainConsole.Instance.Commands.AddCommand("UserService", false,
101 "show account",
102 "show account <first> <last>",
103 "Show account details for the given user", HandleShowAccount);
89 } 104 }
90 105
91 } 106 }
@@ -318,6 +333,36 @@ namespace OpenSim.Services.UserAccountService
318 CreateUser(firstName, lastName, password, email); 333 CreateUser(firstName, lastName, password, email);
319 } 334 }
320 335
336 protected void HandleShowAccount(string module, string[] cmdparams)
337 {
338 if (cmdparams.Length != 4)
339 {
340 MainConsole.Instance.Output("Usage: show account <first-name> <last-name>");
341 return;
342 }
343
344 string firstName = cmdparams[2];
345 string lastName = cmdparams[3];
346
347 UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName);
348
349 if (ua == null)
350 {
351 MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName);
352 return;
353 }
354
355 MainConsole.Instance.OutputFormat("Name: {0}", ua.Name);
356 MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID);
357 MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle);
358 MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email);
359 MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created));
360 MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel);
361 MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags);
362 foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs)
363 MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value);
364 }
365
321 protected void HandleResetUserPassword(string module, string[] cmdparams) 366 protected void HandleResetUserPassword(string module, string[] cmdparams)
322 { 367 {
323 string firstName; 368 string firstName;
@@ -338,16 +383,58 @@ namespace OpenSim.Services.UserAccountService
338 383
339 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 384 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
340 if (account == null) 385 if (account == null)
341 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user"); 386 {
387 MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
388 return;
389 }
342 390
343 bool success = false; 391 bool success = false;
344 if (m_AuthenticationService != null) 392 if (m_AuthenticationService != null)
345 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); 393 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
394
395 if (!success)
396 MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName);
397 else
398 MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName);
399 }
400
401 protected void HandleSetUserLevel(string module, string[] cmdparams)
402 {
403 string firstName;
404 string lastName;
405 string rawLevel;
406 int level;
407
408 if (cmdparams.Length < 4)
409 firstName = MainConsole.Instance.CmdPrompt("First name");
410 else firstName = cmdparams[3];
411
412 if (cmdparams.Length < 5)
413 lastName = MainConsole.Instance.CmdPrompt("Last name");
414 else lastName = cmdparams[4];
415
416 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
417 if (account == null) {
418 MainConsole.Instance.OutputFormat("No such user");
419 return;
420 }
421
422 if (cmdparams.Length < 6)
423 rawLevel = MainConsole.Instance.CmdPrompt("User level");
424 else rawLevel = cmdparams[5];
425
426 if(int.TryParse(rawLevel, out level) == false) {
427 MainConsole.Instance.OutputFormat("Invalid user level");
428 return;
429 }
430
431 account.UserLevel = level;
432
433 bool success = StoreUserAccount(account);
346 if (!success) 434 if (!success)
347 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.", 435 MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName);
348 firstName, lastName);
349 else 436 else
350 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); 437 MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level);
351 } 438 }
352 439
353 #endregion 440 #endregion