From cf317f5c3352f066fd61a0fa5de19c93947be22c Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 23 Jul 2008 22:14:29 +0000 Subject: refactor TaskInventoryItem Mask -> Permissions to be consistant with how things are stored in the db. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 100 ++++++++++----------- .../Scenes/SceneObjectGroup.Inventory.cs | 8 +- .../Scenes/SceneObjectPart.Inventory.cs | 42 ++++----- 3 files changed, 75 insertions(+), 75 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 5caf0f0..d0c5842 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -919,22 +919,22 @@ namespace OpenSim.Region.Environment.Scenes if ((destAgent != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) { - agentItem.BasePermissions = taskItem.NextOwnerMask; - agentItem.CurrentPermissions = taskItem.NextOwnerMask; - agentItem.NextPermissions = taskItem.NextOwnerMask; - agentItem.EveryOnePermissions = taskItem.EveryoneMask & taskItem.NextOwnerMask; + agentItem.BasePermissions = taskItem.NextPermissions; + agentItem.CurrentPermissions = taskItem.NextPermissions; + agentItem.NextPermissions = taskItem.NextPermissions; + agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; } else { - agentItem.BasePermissions = taskItem.BaseMask; - agentItem.CurrentPermissions = taskItem.OwnerMask; - agentItem.NextPermissions = taskItem.NextOwnerMask; - agentItem.EveryOnePermissions = taskItem.EveryoneMask; + agentItem.BasePermissions = taskItem.BasePermissions; + agentItem.CurrentPermissions = taskItem.CurrentPermissions; + agentItem.NextPermissions = taskItem.NextPermissions; + agentItem.EveryOnePermissions = taskItem.EveryonePermissions; } if (!ExternalChecks.ExternalChecksBypassPermissions()) { - if ((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) + if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) part.RemoveInventoryItem(itemId); } @@ -1083,26 +1083,26 @@ namespace OpenSim.Region.Environment.Scenes destTaskItem.ParentID = destPart.UUID; destTaskItem.ParentPartID = destPart.UUID; - destTaskItem.BaseMask = srcTaskItem.BaseMask; - destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask; - destTaskItem.GroupMask = srcTaskItem.GroupMask; - destTaskItem.OwnerMask = srcTaskItem.OwnerMask; - destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask; + destTaskItem.BasePermissions = srcTaskItem.BasePermissions; + destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions; + destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions; + destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions; + destTaskItem.NextPermissions = srcTaskItem.NextPermissions; destTaskItem.Flags = srcTaskItem.Flags; if (destPart.OwnerID != part.OwnerID) { if (ExternalChecks.ExternalChecksPropagatePermissions()) { - destTaskItem.OwnerMask = srcTaskItem.OwnerMask & - srcTaskItem.NextOwnerMask; - destTaskItem.GroupMask = srcTaskItem.GroupMask & - srcTaskItem.NextOwnerMask; - destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask & - srcTaskItem.NextOwnerMask; - destTaskItem.BaseMask = srcTaskItem.BaseMask & - srcTaskItem.NextOwnerMask; - destTaskItem.OwnerMask |= 8; // Slam! + destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & + srcTaskItem.NextPermissions; + destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & + srcTaskItem.NextPermissions; + destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & + srcTaskItem.NextPermissions; + destTaskItem.BasePermissions = srcTaskItem.BasePermissions & + srcTaskItem.NextPermissions; + destTaskItem.CurrentPermissions |= 8; // Slam! } } @@ -1113,7 +1113,7 @@ namespace OpenSim.Region.Environment.Scenes destPart.AddInventoryItem(destTaskItem); - if ((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) + if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) part.RemoveInventoryItem(itemId); ScenePresence avatar; @@ -1331,12 +1331,12 @@ namespace OpenSim.Region.Environment.Scenes taskItem.InvType = itemBase.InvType; taskItem.OwnerID = itemBase.Owner; taskItem.CreatorID = itemBase.Creator; - taskItem.BaseMask = itemBase.BasePermissions; - taskItem.OwnerMask = itemBase.CurrentPermissions; - taskItem.EveryoneMask = itemBase.EveryOnePermissions; - taskItem.NextOwnerMask = itemBase.NextPermissions; + taskItem.BasePermissions = itemBase.BasePermissions; + taskItem.CurrentPermissions = itemBase.CurrentPermissions; + taskItem.EveryonePermissions = itemBase.EveryOnePermissions; + taskItem.NextPermissions = itemBase.NextPermissions; taskItem.GroupID = itemBase.GroupID; - taskItem.GroupMask = 0; + taskItem.GroupPermissions = 0; taskItem.Flags = itemBase.Flags; taskItem.PermsGranter = LLUUID.Zero; taskItem.PermsMask = 0; @@ -1409,26 +1409,26 @@ namespace OpenSim.Region.Environment.Scenes destTaskItem.ParentID = destPart.UUID; destTaskItem.ParentPartID = destPart.UUID; - destTaskItem.BaseMask = srcTaskItem.BaseMask; - destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask; - destTaskItem.GroupMask = srcTaskItem.GroupMask; - destTaskItem.OwnerMask = srcTaskItem.OwnerMask; - destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask; + destTaskItem.BasePermissions = srcTaskItem.BasePermissions; + destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions; + destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions; + destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions; + destTaskItem.NextPermissions = srcTaskItem.NextPermissions; destTaskItem.Flags = srcTaskItem.Flags; if (destPart.OwnerID != srcPart.OwnerID) { if (ExternalChecks.ExternalChecksPropagatePermissions()) { - destTaskItem.OwnerMask = srcTaskItem.OwnerMask & - srcTaskItem.NextOwnerMask; - destTaskItem.GroupMask = srcTaskItem.GroupMask & - srcTaskItem.NextOwnerMask; - destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask & - srcTaskItem.NextOwnerMask; - destTaskItem.BaseMask = srcTaskItem.BaseMask & - srcTaskItem.NextOwnerMask; - destTaskItem.OwnerMask |= 8; // Slam! + destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & + srcTaskItem.NextPermissions; + destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & + srcTaskItem.NextPermissions; + destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & + srcTaskItem.NextPermissions; + destTaskItem.BasePermissions = srcTaskItem.BasePermissions & + srcTaskItem.NextPermissions; + destTaskItem.CurrentPermissions |= 8; // Slam! } } @@ -2088,12 +2088,12 @@ namespace OpenSim.Region.Environment.Scenes { if (ExternalChecks.ExternalChecksPropagatePermissions()) { - if ((item.OwnerMask & 8) != 0) + if ((item.CurrentPermissions & 8) != 0) { foreach (SceneObjectPart part in partList) { - part.EveryoneMask = item.EveryoneMask; - part.NextOwnerMask = item.NextOwnerMask; + part.EveryoneMask = item.EveryonePermissions; + part.NextOwnerMask = item.NextPermissions; } } group.ApplyNextOwnerPermissions(); @@ -2108,10 +2108,10 @@ namespace OpenSim.Region.Environment.Scenes part.OwnerID = item.OwnerID; part.ChangeInventoryOwner(item.OwnerID); } - else if ((item.OwnerMask & 8) != 0) // Slam! + else if ((item.CurrentPermissions & 8) != 0) // Slam! { - part.EveryoneMask = item.EveryoneMask; - part.NextOwnerMask = item.NextOwnerMask; + part.EveryoneMask = item.EveryonePermissions; + part.NextOwnerMask = item.NextPermissions; } } rootPart.TrimPermissions(); @@ -2127,7 +2127,7 @@ namespace OpenSim.Region.Environment.Scenes if (!ExternalChecks.ExternalChecksBypassPermissions()) { - if ((item.OwnerMask & (uint)PermissionMask.Copy) == 0) + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) sourcePart.RemoveInventoryItem(item.ItemID); } return rootPart.ParentGroup; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 0696432..cc4891f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -151,11 +151,11 @@ namespace OpenSim.Region.Environment.Scenes taskItem.Type = item.AssetType; taskItem.InvType = item.InvType; - taskItem.BaseMask = item.BasePermissions; - taskItem.OwnerMask = item.CurrentPermissions; + taskItem.BasePermissions = item.BasePermissions; + taskItem.CurrentPermissions = item.CurrentPermissions; // FIXME: ignoring group permissions for now as they aren't stored in item - taskItem.EveryoneMask = item.EveryOnePermissions; - taskItem.NextOwnerMask = item.NextPermissions; + taskItem.EveryonePermissions = item.EveryOnePermissions; + taskItem.NextPermissions = item.NextPermissions; taskItem.Flags = item.Flags; // TODO: These are pending addition of those fields to TaskInventoryItem // taskItem.SalePrice = item.SalePrice; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 841b7b6..480c030 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -526,8 +526,8 @@ namespace OpenSim.Region.Environment.Scenes { LLUUID ownerID = item.OwnerID; uint everyoneMask = 0; - uint baseMask = item.BaseMask; - uint ownerMask = item.OwnerMask; + uint baseMask = item.BasePermissions; + uint ownerMask = item.CurrentPermissions; if (item.InvType == 10) // Script { @@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(ownerMask)); invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(0)); invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(everyoneMask)); - invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); + invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextPermissions)); invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); invString.AddNameValueLine("owner_id", ownerID.ToString()); @@ -680,28 +680,28 @@ namespace OpenSim.Region.Environment.Scenes { if (item.InvType != 6) { - if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Copy) == 0) + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Modify) == 0) + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) mask &= ~((uint)PermissionMask.Modify >> 13); } else { - if ((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) mask &= ~((uint)PermissionMask.Modify >> 13); } - if ((item.OwnerMask & (uint)PermissionMask.Copy) == 0) + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) mask &= ~(uint)PermissionMask.Copy; - if ((item.OwnerMask & (uint)PermissionMask.Transfer) == 0) + if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) mask &= ~(uint)PermissionMask.Transfer; - if ((item.OwnerMask & (uint)PermissionMask.Modify) == 0) + if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) mask &= ~(uint)PermissionMask.Modify; } return mask; @@ -717,16 +717,16 @@ namespace OpenSim.Region.Environment.Scenes { if (item.InvType == 6) { - if ((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) - item.OwnerMask &= ~(uint)PermissionMask.Copy; - if ((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.OwnerMask &= ~(uint)PermissionMask.Transfer; - if ((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) - item.OwnerMask &= ~(uint)PermissionMask.Modify; + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; } - item.OwnerMask &= item.NextOwnerMask; - item.BaseMask &= item.NextOwnerMask; - item.EveryoneMask &= item.NextOwnerMask; + item.CurrentPermissions &= item.NextPermissions; + item.BasePermissions &= item.NextPermissions; + item.EveryonePermissions &= item.NextPermissions; } TriggerScriptChangedEvent(Changed.OWNER); -- cgit v1.1