From 9bd7f3b03a315d713d53451a36fd64c419ce5f35 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 Dec 2010 20:35:56 +0000 Subject: Revamp the viewer -> banlist packet processing so fix a number of bugs. Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work. --- .../Region/CoreModules/World/Land/LandObject.cs | 200 +++++++++++++++------ 1 file changed, 143 insertions(+), 57 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Land/LandObject.cs') diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index d87352f..801d3a4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected LandData m_landData = new LandData(); protected Scene m_scene; protected List primsOverMe = new List(); + protected Dictionary m_listTransactions = new Dictionary(); public bool[,] LandBitmap { @@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) + //Needs later group support + bool snap_selection = false; + LandData newData = LandData.Copy(); + + uint allowedDelta = 0; + + // These two are always blocked as no client can set them anyway + // ParcelFlags.ForSaleObjects + // ParcelFlags.LindenHome + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) { - //Needs later group support - bool snap_selection = false; - LandData newData = LandData.Copy(); + allowedDelta |= (uint)(ParcelFlags.AllowLandmark | + ParcelFlags.AllowTerraform | + ParcelFlags.AllowDamage | + ParcelFlags.CreateObjects | + ParcelFlags.RestrictPushObject | + ParcelFlags.AllowGroupScripts | + ParcelFlags.CreateGroupObjects | + ParcelFlags.AllowAPrimitiveEntry | + ParcelFlags.AllowGroupObjectEntry); + } - if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) + { + if (args.AuthBuyerID != newData.AuthBuyerID || + args.SalePrice != newData.SalePrice) { - if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) - { - newData.AuthBuyerID = args.AuthBuyerID; - newData.SalePrice = args.SalePrice; - snap_selection = true; - } + snap_selection = true; + } + + newData.AuthBuyerID = args.AuthBuyerID; + newData.SalePrice = args.SalePrice; + + if (!LandData.IsGroupOwned) + { + newData.GroupID = args.GroupID; + + allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup | + ParcelFlags.ContributeWithDeed | + ParcelFlags.SellParcelObjects); } + + allowedDelta |= (uint)ParcelFlags.ForSale; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) + { newData.Category = args.Category; + + allowedDelta |= (uint)(ParcelFlags.ShowDirectory | + ParcelFlags.AllowPublish | + ParcelFlags.MaturePublish); + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) + { newData.Description = args.Desc; - newData.GroupID = args.GroupID; + newData.Name = args.Name; + newData.SnapshotID = args.SnapshotID; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) + { newData.LandingType = args.LandingType; + newData.UserLocation = args.UserLocation; + newData.UserLookAt = args.UserLookAt; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) + { newData.MediaAutoScale = args.MediaAutoScale; newData.MediaID = args.MediaID; newData.MediaURL = args.MediaURL; newData.MusicURL = args.MusicURL; - newData.Name = args.Name; - newData.Flags = args.ParcelFlags; - newData.PassHours = args.PassHours; - newData.PassPrice = args.PassPrice; - newData.SnapshotID = args.SnapshotID; - newData.UserLocation = args.UserLocation; - newData.UserLookAt = args.UserLookAt; newData.MediaType = args.MediaType; newData.MediaDescription = args.MediaDescription; newData.MediaWidth = args.MediaWidth; @@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land newData.ObscureMusic = args.ObscureMusic; newData.ObscureMedia = args.ObscureMedia; - m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); + allowedDelta |= (uint)(ParcelFlags.SoundLocal | + ParcelFlags.UrlWebPage | + ParcelFlags.UrlRawHtml | + ParcelFlags.AllowVoiceChat | + ParcelFlags.UseEstateVoiceChan); + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) + { + newData.PassHours = args.PassHours; + newData.PassPrice = args.PassPrice; + + allowedDelta |= (uint)ParcelFlags.UsePassList; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) + { + allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | + ParcelFlags.UseAccessList); + } - SendLandUpdateToAvatarsOverMe(snap_selection); + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) + { + allowedDelta |= (uint)(ParcelFlags.UseBanList | + ParcelFlags.DenyAnonymous | + ParcelFlags.DenyAgeUnverified); } + + uint preserve = LandData.Flags & ~allowedDelta; + newData.Flags = preserve | (args.ParcelFlags & allowedDelta); + + m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); + + SendLandUpdateToAvatarsOverMe(snap_selection); } public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) @@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = avatar; - entry.Flags = AccessList.Ban; - entry.Time = new DateTime(); - //See if they are on the list, but make sure the owner isn't banned - if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) + if (LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Ban) + return true; + return false; + }) != -1 && LandData.OwnerID != avatar) { - //They are banned, so lets send them a notice about this parcel return true; } } @@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = avatar; - entry.Flags = AccessList.Access; - entry.Time = new DateTime(); - - //If they are not on the access list and are not the owner - if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) + if (LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Access) + return true; + return false; + }) == -1 && LandData.OwnerID != avatar) { - //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel return true; } } @@ -421,39 +496,50 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void UpdateAccessList(uint flags, List entries, IClientAPI remote_client) + public void UpdateAccessList(uint flags, UUID transactionID, + int sequenceID, int sections, + List entries, + IClientAPI remote_client) { LandData newData = LandData.Copy(); - if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) + if ((!m_listTransactions.ContainsKey(flags)) || + m_listTransactions[flags] != transactionID) { - entries.Clear(); - } + m_listTransactions[flags] = transactionID; - List toRemove = new List(); - foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) - { - if (entry.Flags == (AccessList)flags) + List toRemove = + new List(); + + foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) { - toRemove.Add(entry); + if (entry.Flags == (AccessList)flags) + toRemove.Add(entry); } - } - foreach (ParcelManager.ParcelAccessEntry entry in toRemove) - { - newData.ParcelAccessList.Remove(entry); + foreach (ParcelManager.ParcelAccessEntry entry in toRemove) + { + newData.ParcelAccessList.Remove(entry); + } + + // Checked here because this will always be the first + // and only packet in a transaction + if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) + { + return; + } } + foreach (ParcelManager.ParcelAccessEntry entry in entries) { - ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); + ParcelManager.ParcelAccessEntry temp = + new ParcelManager.ParcelAccessEntry(); + temp.AgentID = entry.AgentID; - temp.Time = new DateTime(); //Pointless? Yes. + temp.Time = entry.Time; temp.Flags = (AccessList)flags; - if (!newData.ParcelAccessList.Contains(temp)) - { - newData.ParcelAccessList.Add(temp); - } + newData.ParcelAccessList.Add(temp); } m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); @@ -711,7 +797,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) { List resultLocalIDs = new List(); try @@ -761,7 +847,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// public void SendLandObjectOwners(IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) { Dictionary primCount = new Dictionary(); List groups = new List(); -- cgit v1.1