aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs67
1 files changed, 66 insertions, 1 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index dd0ea67..77f38ed 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -41,11 +41,15 @@ using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics; 42using OpenSim.Framework.Statistics;
43using OpenSim.Region.ClientStack; 43using OpenSim.Region.ClientStack;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
44using OpenSim.Region.Framework; 45using OpenSim.Region.Framework;
45using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.Physics.Manager;
48using OpenSim.Server.Base; 49using OpenSim.Server.Base;
50using OpenSim.Services.Base;
51using OpenSim.Services.Interfaces;
52using OpenSim.Services.UserAccountService;
49 53
50namespace OpenSim 54namespace OpenSim
51{ 55{
@@ -411,6 +415,9 @@ namespace OpenSim
411 scene.SnmpService.BootInfo("Loading prins", scene); 415 scene.SnmpService.BootInfo("Loading prins", scene);
412 } 416 }
413 417
418 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
419 SetUpEstateOwner(scene);
420
414 // Prims have to be loaded after module configuration since some modules may be invoked during the load 421 // Prims have to be loaded after module configuration since some modules may be invoked during the load
415 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 422 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
416 423
@@ -494,6 +501,64 @@ namespace OpenSim
494 return clientServer; 501 return clientServer;
495 } 502 }
496 503
504 /// <summary>
505 /// Try to set up the estate owner for the given scene.
506 /// </summary>
507 /// <remarks>
508 /// The involves asking the user for information about the user on the console. If the user does not already
509 /// exist then it is created.
510 /// </remarks>
511 /// <param name="scene"></param>
512 private void SetUpEstateOwner(Scene scene)
513 {
514 RegionInfo regionInfo = scene.RegionInfo;
515
516 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
517 List<char> excluded = new List<char>(new char[1]{' '});
518 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
519 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
520
521 UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
522
523 if (account == null)
524 {
525
526 // XXX: The LocalUserAccountServicesConnector is currently registering its inner service rather than
527 // itself!
528// if (scene.UserAccountService is LocalUserAccountServicesConnector)
529// {
530// IUserAccountService innerUas
531// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService;
532//
533// m_log.DebugFormat("B {0}", innerUas.GetType());
534//
535// if (innerUas is UserAccountService)
536// {
537
538 if (scene.UserAccountService is UserAccountService)
539 {
540 string password = MainConsole.Instance.PasswdPrompt("Password");
541 string email = MainConsole.Instance.CmdPrompt("Email", "");
542
543 account
544 = ((UserAccountService)scene.UserAccountService).CreateUser(
545 regionInfo.ScopeID, first, last, password, email);
546 }
547// }
548 }
549
550 if (account == null)
551 {
552 m_log.ErrorFormat(
553 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
554 }
555 else
556 {
557 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
558 regionInfo.EstateSettings.Save();
559 }
560 }
561
497 private void ShutdownRegion(Scene scene) 562 private void ShutdownRegion(Scene scene)
498 { 563 {
499 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); 564 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName);