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 --- .../World/Estate/EstateManagementModule.cs | 244 +++++++++++++-------- 1 file changed, 152 insertions(+), 92 deletions(-) (limited to 'OpenSim/Region/CoreModules/World') 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"); + } } } -- cgit v1.1