From 99f42c0a6ec064d7b625c9b33e185a5e153d6be8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 27 May 2011 19:05:16 -0400 Subject: Add option to disable logins This just covers script loading for now. More to come. --- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +++++++++++++++- .../RegionReadyModule/RegionReadyModule.cs | 25 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4aae13c..e9f5f9e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -94,7 +94,10 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; public int MaxUndoCount = 5; + // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; + public bool LoginLock = false; public bool LoginsDisabled = true; + public bool StartDisabled = false; public bool LoadingPrims; public IXfer XferManager; @@ -1373,10 +1376,23 @@ namespace OpenSim.Region.Framework.Scenes IConfig startupConfig = m_config.Configs["Startup"]; if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) { + if (m_sceneGraph.GetActiveScriptsCount() == 0) + { + LoginLock = false; + } m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - LoginsDisabled = false; + // For RegionReady lockouts + if( LoginLock == false) + { + LoginsDisabled = false; + } m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); } + else + { + StartDisabled = true; + LoginsDisabled = true; + } } } catch (NotImplementedException) diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 122ad40..c59c88c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -28,10 +28,13 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.Net; +using System.IO; using log4net; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -50,6 +53,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady private bool m_lastOarLoadedOk; private int m_channelNotify = -1000; private bool m_enabled = false; + private bool m_disable_logins = false; Scene m_scene = null; @@ -68,10 +72,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (m_config != null) { m_enabled = m_config.GetBoolean("enabled", false); + if (m_enabled) { m_channelNotify = m_config.GetInt("channel_notify", m_channelNotify); - } + m_disable_logins = m_config.GetBoolean("login_disable", false); + } } // if (!m_enabled) @@ -93,6 +99,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); + + if(m_disable_logins == true) + { + scene.LoginLock = true; + scene.LoginsDisabled = true; + m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName); + } } public void RemoveRegion(Scene scene) @@ -148,6 +161,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady c.SenderUUID = UUID.Zero; c.Scene = m_scene; + if(m_disable_logins == true) + { + if(m_scene.StartDisabled == false) + { + m_scene.LoginsDisabled = false; + m_scene.LoginLock = false; + m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); + } + } + m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.EventManager.TriggerOnChatBroadcast(this, c); -- cgit v1.1