aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs115
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs97
2 files changed, 151 insertions, 61 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 6d63748..186ca71 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
@@ -311,14 +311,18 @@ namespace OpenSim.Services.GridService
311 return true; 311 return true;
312 } 312 }
313 313
314 uint x, y; 314 // We are now performing this check for each individual teleport in the EntityTransferModule instead. This
315 if (m_Check4096 && !Check4096(handle, out x, out y)) 315 // allows us to give better feedback when teleports fail because of the distance reason (which can't be
316 { 316 // done here) and it also hypergrid teleports that are within range (possibly because the source grid
317 RemoveHyperlinkRegion(regInfo.RegionID); 317 // itself has regions that are very far apart).
318 reason = "Region is too far (" + x + ", " + y + ")"; 318// uint x, y;
319 m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); 319// if (m_Check4096 && !Check4096(handle, out x, out y))
320 return false; 320// {
321 } 321// //RemoveHyperlinkRegion(regInfo.RegionID);
322// reason = "Region is too far (" + x + ", " + y + ")";
323// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
324// //return false;
325// }
322 326
323 regInfo.RegionID = regionID; 327 regInfo.RegionID = regionID;
324 328
@@ -369,60 +373,59 @@ namespace OpenSim.Services.GridService
369 } 373 }
370 } 374 }
371 375
372 /// <summary> 376// Not currently used
373 /// Cope with this viewer limitation. 377// /// <summary>
374 /// </summary> 378// /// Cope with this viewer limitation.
375 /// <param name="regInfo"></param> 379// /// </summary>
376 /// <returns></returns> 380// /// <param name="regInfo"></param>
377 public bool Check4096(ulong realHandle, out uint x, out uint y) 381// /// <returns></returns>
378 { 382// public bool Check4096(ulong realHandle, out uint x, out uint y)
379 uint ux = 0, uy = 0; 383// {
380 Utils.LongToUInts(realHandle, out ux, out uy); 384// uint ux = 0, uy = 0;
381 x = ux / Constants.RegionSize; 385// Utils.LongToUInts(realHandle, out ux, out uy);
382 y = uy / Constants.RegionSize; 386// x = ux / Constants.RegionSize;
383 387// y = uy / Constants.RegionSize;
384 const uint limit = (4096 - 1) * Constants.RegionSize; 388//
385 uint xmin = ux - limit; 389// const uint limit = (4096 - 1) * Constants.RegionSize;
386 uint xmax = ux + limit; 390// uint xmin = ux - limit;
387 uint ymin = uy - limit; 391// uint xmax = ux + limit;
388 uint ymax = uy + limit; 392// uint ymin = uy - limit;
389 // World map boundary checks 393// uint ymax = uy + limit;
390 if (xmin < 0 || xmin > ux) 394// // World map boundary checks
391 xmin = 0; 395// if (xmin < 0 || xmin > ux)
392 if (xmax > int.MaxValue || xmax < ux) 396// xmin = 0;
393 xmax = int.MaxValue; 397// if (xmax > int.MaxValue || xmax < ux)
394 if (ymin < 0 || ymin > uy) 398// xmax = int.MaxValue;
395 ymin = 0; 399// if (ymin < 0 || ymin > uy)
396 if (ymax > int.MaxValue || ymax < uy) 400// ymin = 0;
397 ymax = int.MaxValue; 401// if (ymax > int.MaxValue || ymax < uy)
398 402// ymax = int.MaxValue;
399 // Check for any regions that are within the possible teleport range to the linked region 403//
400 List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); 404// // Check for any regions that are within the possible teleport range to the linked region
401 if (regions.Count == 0) 405// List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
402 { 406// if (regions.Count == 0)
403 return false; 407// {
404 } 408// return false;
405 else 409// }
406 { 410// else
407 // Check for regions which are not linked regions 411// {
408 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 412// // Check for regions which are not linked regions
409 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 413// List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
410 if (availableRegions.Count() == 0) 414// IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
411 return false; 415// if (availableRegions.Count() == 0)
412 } 416// return false;
413 417// }
414 return true; 418//
415 } 419// return true;
420// }
416 421
417 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 422 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
418 { 423 {
419
420 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); 424 RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
421 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; 425 int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
422 rdata.Data["flags"] = flags.ToString(); 426 rdata.Data["flags"] = flags.ToString();
423 427
424 m_Database.Store(rdata); 428 m_Database.Store(rdata);
425
426 } 429 }
427 430
428 private void RemoveHyperlinkRegion(UUID regionID) 431 private void RemoveHyperlinkRegion(UUID regionID)
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index cbd6f35..dbf5ef4 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 }
@@ -337,6 +352,36 @@ namespace OpenSim.Services.UserAccountService
337 CreateUser(firstName, lastName, password, email); 352 CreateUser(firstName, lastName, password, email);
338 } 353 }
339 354
355 protected void HandleShowAccount(string module, string[] cmdparams)
356 {
357 if (cmdparams.Length != 4)
358 {
359 MainConsole.Instance.Output("Usage: show account <first-name> <last-name>");
360 return;
361 }
362
363 string firstName = cmdparams[2];
364 string lastName = cmdparams[3];
365
366 UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName);
367
368 if (ua == null)
369 {
370 MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName);
371 return;
372 }
373
374 MainConsole.Instance.OutputFormat("Name: {0}", ua.Name);
375 MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID);
376 MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle);
377 MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email);
378 MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created));
379 MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel);
380 MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags);
381 foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs)
382 MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value);
383 }
384
340 protected void HandleResetUserPassword(string module, string[] cmdparams) 385 protected void HandleResetUserPassword(string module, string[] cmdparams)
341 { 386 {
342 string firstName; 387 string firstName;
@@ -357,16 +402,58 @@ namespace OpenSim.Services.UserAccountService
357 402
358 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 403 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
359 if (account == null) 404 if (account == null)
360 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user"); 405 {
406 MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
407 return;
408 }
361 409
362 bool success = false; 410 bool success = false;
363 if (m_AuthenticationService != null) 411 if (m_AuthenticationService != null)
364 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); 412 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
413
414 if (!success)
415 MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName);
416 else
417 MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName);
418 }
419
420 protected void HandleSetUserLevel(string module, string[] cmdparams)
421 {
422 string firstName;
423 string lastName;
424 string rawLevel;
425 int level;
426
427 if (cmdparams.Length < 4)
428 firstName = MainConsole.Instance.CmdPrompt("First name");
429 else firstName = cmdparams[3];
430
431 if (cmdparams.Length < 5)
432 lastName = MainConsole.Instance.CmdPrompt("Last name");
433 else lastName = cmdparams[4];
434
435 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
436 if (account == null) {
437 MainConsole.Instance.OutputFormat("No such user");
438 return;
439 }
440
441 if (cmdparams.Length < 6)
442 rawLevel = MainConsole.Instance.CmdPrompt("User level");
443 else rawLevel = cmdparams[5];
444
445 if(int.TryParse(rawLevel, out level) == false) {
446 MainConsole.Instance.OutputFormat("Invalid user level");
447 return;
448 }
449
450 account.UserLevel = level;
451
452 bool success = StoreUserAccount(account);
365 if (!success) 453 if (!success)
366 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.", 454 MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName);
367 firstName, lastName);
368 else 455 else
369 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); 456 MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level);
370 } 457 }
371 458
372 #endregion 459 #endregion