From 9b60c14bb10301db9a3333ca815afd3296b981a8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 03:05:30 +0000 Subject: minor: Add some console feedback on region restart and log who requested a region restart if done from the viewer. --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 39cc93d..757e5d4 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -271,6 +271,10 @@ namespace OpenSim.Region.CoreModules.World.Estate } restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); + + m_log.InfoFormat( + "User {0} requested restart of region {1} in {2} seconds", + remoteClient.Name, Scene.Name, times.Count != 0 ? times[0] : 0); } } -- cgit v1.1 From 36c6edac6903ecb704d382ed0959ff3cc44b73bb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 03:29:50 +0000 Subject: Remove the redundant BypassPermissions() checks in EstateManagmentModule. This is repeated in the PermissionsModule and checking it earlier does not allow a force override of the bypass value --- .../World/Estate/EstateManagementModule.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 757e5d4..f974a63 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.World.Estate if ((estateAccessType & 4) != 0) // User add { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { @@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 8) != 0) // User remove { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { @@ -362,7 +362,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 16) != 0) // Group add { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { @@ -391,9 +391,10 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 32) != 0) // Group remove { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { @@ -422,9 +423,10 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 64) != 0) // Ban add { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) { EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; @@ -499,9 +501,10 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 128) != 0) // Ban remove { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) { EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; @@ -554,9 +557,10 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 256) != 0) // Manager add { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { @@ -585,9 +589,10 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 512) != 0) // Manager remove { - if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) { if ((estateAccessType & 1) != 0) // All estates { -- cgit v1.1 From f473252fa8022f95f60e219b24ffa342966f8c13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 03:56:53 +0000 Subject: Add AllowRegionRestartFromClient setting to [EstateManagement] section of OpenSim.ini. Setting this to false will block all restart requests from the viewer even if they are otherwise legitimate. One use is to block region restarts if necessary whilst restart functionality remains buggy or triggers bugs in modules, though these should be fixed as soon as practicable. Default is true, as has been the case historically. --- .../World/Estate/EstateManagementModule.cs | 103 +++++++++++++-------- 1 file changed, 63 insertions(+), 40 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index f974a63..eb06fcc 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate protected EstateManagementCommands m_commands; + /// + /// If false, region restart requests from the client are blocked even if they are otherwise legitimate. + /// + public bool AllowRegionRestartFromClient { get; set; } + private EstateTerrainXferHandler TerrainUploader; public TelehubManager m_Telehub; @@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate public event ChangeDelegate OnEstateInfoChange; public event MessageDelegate OnEstateMessage; + #region Region Module interface + + public string Name { get { return "EstateManagementModule"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { + AllowRegionRestartFromClient = true; + + IConfig config = source.Configs["EstateManagement"]; + + if (config != null) + AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true); + } + + public void AddRegion(Scene scene) + { + Scene = scene; + Scene.RegisterModuleInterface(this); + Scene.EventManager.OnNewClient += EventManager_OnNewClient; + Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; + + m_Telehub = new TelehubManager(scene); + + m_commands = new EstateManagementCommands(this); + m_commands.Initialise(); + } + + public void RemoveRegion(Scene scene) {} + + public void RegionLoaded(Scene scene) + { + // Sets up the sun module based no the saved Estate and Region Settings + // DO NOT REMOVE or the sun will stop working + scene.TriggerEstateSunUpdate(); + + UserManager = scene.RequestModuleInterface(); + } + + public void Close() + { + m_commands.Close(); + } + + #endregion + #region Packet Data Responders private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) @@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); @@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); @@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { + if (!AllowRegionRestartFromClient) + { + remoteClient.SendAlertMessage("Region restart has been disabled on this simulator."); + return; + } + IRestartModule restartModule = Scene.RequestModuleInterface(); if (restartModule != null) { @@ -329,6 +389,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } + if ((estateAccessType & 8) != 0) // User remove { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -360,6 +421,7 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 16) != 0) // Group add { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -623,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } - public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) { SceneObjectPart part; @@ -1081,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion - #region Region Module interface - - public string Name { get { return "EstateManagementModule"; } } - - public Type ReplaceableInterface { get { return null; } } - - public void Initialise(IConfigSource source) {} - - public void AddRegion(Scene scene) - { - Scene = scene; - Scene.RegisterModuleInterface(this); - Scene.EventManager.OnNewClient += EventManager_OnNewClient; - Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - - m_Telehub = new TelehubManager(scene); - - m_commands = new EstateManagementCommands(this); - m_commands.Initialise(); - } - - public void RemoveRegion(Scene scene) {} - - public void RegionLoaded(Scene scene) - { - // Sets up the sun module based no the saved Estate and Region Settings - // DO NOT REMOVE or the sun will stop working - scene.TriggerEstateSunUpdate(); - - UserManager = scene.RequestModuleInterface(); - } - - public void Close() - { - m_commands.Close(); - } - - #endregion - #region Other Functions public void changeWaterHeight(float height) -- cgit v1.1