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/ClientStack/LindenUDP/LLClientView.cs | 12 +-- .../Region/Environment/Scenes/Scene.Inventory.cs | 100 ++++++++++----------- .../Scenes/SceneObjectGroup.Inventory.cs | 8 +- .../Scenes/SceneObjectPart.Inventory.cs | 42 ++++----- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 12 +-- .../Shared/Api/Implementation/LSL_Api.cs | 12 +-- 6 files changed, 93 insertions(+), 93 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d1fd63c..efc910a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4756,7 +4756,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (ti.OwnerID != AgentId) break; - if ((ti.OwnerMask & ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) + if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) break; if (ti.AssetID != requestID) @@ -5103,11 +5103,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP newTaskItem.CreatorID = updatetask.InventoryData.CreatorID; newTaskItem.OwnerID = updatetask.InventoryData.OwnerID; newTaskItem.GroupID = updatetask.InventoryData.GroupID; - newTaskItem.BaseMask = updatetask.InventoryData.BaseMask; - newTaskItem.OwnerMask = updatetask.InventoryData.OwnerMask; - newTaskItem.GroupMask = updatetask.InventoryData.GroupMask; - newTaskItem.EveryoneMask = updatetask.InventoryData.EveryoneMask; - newTaskItem.NextOwnerMask = updatetask.InventoryData.NextOwnerMask; + newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask; + newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask; + newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; + newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; + newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; newTaskItem.Type = updatetask.InventoryData.Type; newTaskItem.InvType = updatetask.InventoryData.InvType; 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); diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 50691a5..2d5be27 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3361,7 +3361,7 @@ namespace OpenSim.Region.ScriptEngine.Common { if (inv.Value.Name == name) { - if ((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) + if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) { return inv.Value.AssetID.ToString(); } @@ -6508,15 +6508,15 @@ namespace OpenSim.Region.ScriptEngine.Common switch (mask) { case 0: - return (int)inv.Value.BaseMask; + return (int)inv.Value.BasePermissions; case 1: - return (int)inv.Value.OwnerMask; + return (int)inv.Value.CurrentPermissions; case 2: - return (int)inv.Value.GroupMask; + return (int)inv.Value.GroupPermissions; case 3: - return (int)inv.Value.EveryoneMask; + return (int)inv.Value.EveryonePermissions; case 4: - return (int)inv.Value.NextOwnerMask; + return (int)inv.Value.NextPermissions; } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a747586..9832cfc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3302,7 +3302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (inv.Value.Name == name) { - if ((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) + if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) { return inv.Value.AssetID.ToString(); } @@ -6287,15 +6287,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch (mask) { case 0: - return (int)inv.Value.BaseMask; + return (int)inv.Value.BasePermissions; case 1: - return (int)inv.Value.OwnerMask; + return (int)inv.Value.CurrentPermissions; case 2: - return (int)inv.Value.GroupMask; + return (int)inv.Value.GroupPermissions; case 3: - return (int)inv.Value.EveryoneMask; + return (int)inv.Value.EveryonePermissions; case 4: - return (int)inv.Value.NextOwnerMask; + return (int)inv.Value.NextPermissions; } } } -- cgit v1.1