From 063f106cbbc2a805dc210fe16c30741ab24876cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 14:17:44 +0000 Subject: Add functionality to estate "Allowed Users" and "Allowed Groups". Allowed users will be honored now, while allowed groups will not. This requires additional groups module integration work --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 17 +- .../World/Estate/EstateManagementModule.cs | 244 +++++++++++++-------- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../Server/IRCClientView.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- 5 files changed, 164 insertions(+), 103 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7d90a68..3d3c324 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3912,7 +3912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) + { EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); packet.AgentData.TransactionID = UUID.Random(); @@ -3921,26 +3922,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.MethodData.Invoice = invoice; packet.MethodData.Method = Utils.StringToBytes("setaccess"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length]; - for (int i = 0; i < (6 + EstateManagers.Length); i++) + for (int i = 0; i < (6 + Data.Length); i++) { returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); } int j = 0; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(EstateManagers.Length.ToString()); j++; - for (int i = 0; i < EstateManagers.Length; i++) + returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++; + for (int i = 0; i < Data.Length; i++) { - returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; + returnblock[j].Parameter = Data[i].GetBytes(); j++; } packet.ParamList = returnblock; - packet.Header.Reliable = false; + packet.Header.Reliable = true; OutPacket(packet, ThrottleOutPacketType.Task); } diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index b1dcb14..deade6b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -75,10 +75,21 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); - remote_client.SendEstateManagersList(invoice, + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AccessOptions, + m_scene.RegionInfo.EstateSettings.EstateAccess, + m_scene.RegionInfo.EstateSettings.EstateID); + + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AllowedGroups, + m_scene.RegionInfo.EstateSettings.EstateGroups, + m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); @@ -233,127 +244,176 @@ namespace OpenSim.Region.CoreModules.World.Estate if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID) return; // never process owner - switch (estateAccessType) + if ((estateAccessType & 4) != 0) // User add { - case 64: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) - { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - - bool alreadyInList = false; - - for (int i = 0; i < banlistcheck.Length; i++) - { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - break; - } - - } - if (!alreadyInList) - { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } - EstateBan item = new EstateBan(); + } + if ((estateAccessType & 8) != 0) // User remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); - item.BannedUserID = user; - item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; - item.BannedHostAddress = "0.0.0.0"; - item.BannedHostIPMask = "0.0.0.0"; + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 16) != 0) // Group add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 32) != 0) // Group remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 64) != 0) // Ban add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - ScenePresence s = m_scene.GetScenePresence(user); - if (s != null) - { - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(user, s.ControllingClient); - } - } + bool alreadyInList = false; - } - else + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].BannedUserID) { - remote_client.SendAlertMessage("User is already on the region ban list"); + alreadyInList = true; + break; } - //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); - } - else - { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } - break; - case 128: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (!alreadyInList) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - bool alreadyInList = false; - EstateBan listitem = null; + EstateBan item = new EstateBan(); + + item.BannedUserID = user; + item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.BannedHostAddress = "0.0.0.0"; + item.BannedHostIPMask = "0.0.0.0"; - for (int i = 0; i < banlistcheck.Length; i++) + m_scene.RegionInfo.EstateSettings.AddBan(item); + m_scene.RegionInfo.EstateSettings.Save(); + + ScenePresence s = m_scene.GetScenePresence(user); + if (s != null) { - if (user == banlistcheck[i].BannedUserID) + if (!s.IsChildAgent) { - alreadyInList = true; - listitem = banlistcheck[i]; - break; + s.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(user, s.ControllingClient); } - } - if (alreadyInList && listitem != null) - { - m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); - m_scene.RegionInfo.EstateSettings.Save(); - } - 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.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is already on the region ban list"); } - break; - case 256: + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 128) != 0) // Ban remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) - { - m_scene.RegionInfo.EstateSettings.AddEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); - } - else + bool alreadyInList = false; + EstateBan listitem = null; + + for (int i = 0; i < banlistcheck.Length; i++) { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } + if (user == banlistcheck[i].BannedUserID) + { + alreadyInList = true; + listitem = banlistcheck[i]; + break; + } - break; - case 512: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + } + if (alreadyInList && listitem != null) { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); m_scene.RegionInfo.EstateSettings.Save(); - - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is not on the region ban list"); } - break; - - default: + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 256) != 0) // Manager add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 512) != 0) // Manager remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); - m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); - break; + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index d5218b5..1dfa1b1 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -879,7 +879,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 55bbed9..6785c08 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1220,7 +1220,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fa47d16..4a4c515 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -897,7 +897,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } -- cgit v1.1