From 522d6261f11ffaf8320c3f0775beb5d0608ce226 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Sep 2011 00:12:12 +0100 Subject: Correctly create a freshly created estate owner's default items and avatar entries on standalone if applicable. --- OpenSim/Region/Application/OpenSimBase.cs | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 92e8ed1..3060169 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -41,11 +41,14 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Region.ClientStack; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Services.UserAccountService; namespace OpenSim { @@ -362,6 +365,53 @@ namespace OpenSim scene.SetModuleInterfaces(); + // FIXME: Put me into a separate method! + while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) + { + MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); + List excluded = new List(new char[1]{' '}); + string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); + string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); + + UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); + + if (account == null) + { + m_log.DebugFormat("A {0}", scene.UserAccountService.GetType()); + +// if (scene.UserAccountService is LocalUserAccountServicesConnector) +// { +// IUserAccountService innerUas +// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService; +// +// m_log.DebugFormat("B {0}", innerUas.GetType()); +// +// if (innerUas is UserAccountService) +// { + + if (scene.UserAccountService is UserAccountService) + { + string password = MainConsole.Instance.PasswdPrompt("Password"); + string email = MainConsole.Instance.CmdPrompt("Email", ""); + + // TODO: Where do we put m_regInfo.ScopeID? + account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email); + } +// } + } + + if (account == null) + { + m_log.ErrorFormat( + "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); + } + else + { + regionInfo.EstateSettings.EstateOwner = account.PrincipalID; + regionInfo.EstateSettings.Save(); + } + } + // Prims have to be loaded after module configuration since some modules may be invoked during the load scene.LoadPrimsFromStorage(regionInfo.originRegionID); -- cgit v1.1