From a5860ad438885cbf76a36dc7958947355522b8cf Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 21 Jun 2008 03:29:08 +0000 Subject: * Adds Region ban capability to Regions. You access this by going to World->Region/Estate. Then on the Estate tab, at the lower right hand corner, clicking the 'Add' button and picking an avatar. * It only persists across reboots for the mySQL datastore currently. * Currently have stubs in the other datastores. --- .../Environment/Interfaces/IRegionDataStore.cs | 6 ++ .../Modules/World/Estate/EstateManagementModule.cs | 86 +++++++++++++++++++++- .../Environment/Modules/World/NPC/NPCAvatar.cs | 5 ++ OpenSim/Region/Environment/Scenes/Scene.cs | 37 ++++++++++ 4 files changed, 133 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index c757461..0ea2c03 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs @@ -72,6 +72,12 @@ namespace OpenSim.Region.Environment.Interfaces void RemoveLandObject(LLUUID globalID); List LoadLandObjects(LLUUID regionUUID); + List LoadRegionBanList(LLUUID regionUUID); + void AddToRegionBanlist(RegionBanListItem item); + void RemoveFromRegionBanlist(RegionBanListItem item); + + + void Shutdown(); } } diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 147e4aa..b6d2ab4 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate { remote_client.sendDetailedEstateData(invoice,m_scene.RegionInfo.EstateSettings.estateName,m_scene.RegionInfo.EstateSettings.estateID); remote_client.sendEstateManagersList(invoice,m_scene.RegionInfo.EstateSettings.estateManagers,m_scene.RegionInfo.EstateSettings.estateID); + remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); } private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, @@ -206,6 +207,89 @@ namespace OpenSim.Region.Environment.Modules.World.Estate switch (estateAccessType) { + case 64: + if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + { + RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); + + bool alreadyInList = false; + + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].bannedUUID) + { + alreadyInList = true; + break; + } + + } + if (!alreadyInList) + { + + RegionBanListItem item = new RegionBanListItem(); + + item.bannedUUID = user; + item.regionUUID = m_scene.RegionInfo.RegionID; + item.bannedIP = "0.0.0.0"; + item.bannedIPHostMask = "0.0.0.0"; + + m_scene.RegionInfo.regionBanlist.Add(item); + m_scene.AddToRegionBanlist(item); + + ScenePresence s = m_scene.GetScenePresence(user); + if (s != null) + { + m_scene.TeleportClientHome(user, s.ControllingClient); + } + + } + else + { + remote_client.SendAlertMessage("User is already on the region ban list"); + } + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + break; + case 128: + if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) + { + RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); + + bool alreadyInList = false; + RegionBanListItem listitem = null; + + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].bannedUUID) + { + alreadyInList = true; + listitem = banlistcheck[i]; + break; + } + + } + if (alreadyInList && listitem != null) + { + m_scene.RegionInfo.regionBanlist.Remove(listitem); + m_scene.RemoveFromRegionBanlist(listitem); + } + else + { + remote_client.SendAlertMessage("User is not on the region ban list"); + } + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + break; case 256: // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml @@ -237,7 +321,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate default: - m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); + m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); break; } } diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index a242ebe..50403b9 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -743,6 +743,11 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID) { } + + public void sendBannedUserList(LLUUID invoice, List banlist, uint estateID) + { + } + public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) { } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cfebd14..73b3a49 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1437,6 +1437,20 @@ namespace OpenSim.Region.Environment.Scenes } } + public void LoadRegionBanlist() + { + List regionbanlist = m_storageManager.DataStore.LoadRegionBanList(m_regInfo.RegionID); + m_regInfo.regionBanlist = regionbanlist; + } + public void AddToRegionBanlist(RegionBanListItem item) + { + m_storageManager.DataStore.AddToRegionBanlist(item); + } + + public void RemoveFromRegionBanlist(RegionBanListItem item) + { + m_storageManager.DataStore.RemoveFromRegionBanlist(item); + } #endregion #region Primitives Methods @@ -1854,6 +1868,18 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart RootPrim = GetSceneObjectPart(primID); if (RootPrim != null) { + if (m_regInfo.CheckIfUserBanned(RootPrim.OwnerID)) + { + SceneObjectGroup grp = RootPrim.ParentGroup; + if (grp != null) + { + DeleteSceneObject(grp); + } + + m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar"); + + return false; + } if (RootPrim.Shape.PCode == (byte)PCode.Prim) { SceneObjectGroup grp = RootPrim.ParentGroup; @@ -2333,6 +2359,13 @@ namespace OpenSim.Region.Environment.Scenes { if (regionHandle == m_regInfo.RegionHandle) { + if (m_regInfo.CheckIfUserBanned(agent.AgentID)) + { + m_log.WarnFormat( + "[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist", + agent.AgentID, regionHandle, RegionInfo.RegionName); + } + capsPaths[agent.AgentID] = agent.CapsPath; if (!agent.child) @@ -3599,5 +3632,9 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + + } } + + \ No newline at end of file -- cgit v1.1