diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6557003..b53c355 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", | 360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", |
361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
362 | 362 | ||
363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part)) |
364 | { | 364 | { |
365 | StoreScriptError(item.ItemID, "no permission"); | 365 | StoreScriptError(item.ItemID, "no permission"); |
366 | return false; | 366 | return false; |
@@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
807 | else | 807 | else |
808 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 808 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
809 | 809 | ||
810 | m_part.AggregateInnerPerms(); | ||
810 | m_inventorySerial++; | 811 | m_inventorySerial++; |
811 | //m_inventorySerial += 2; | 812 | //m_inventorySerial += 2; |
812 | HasInventoryChanged = true; | 813 | HasInventoryChanged = true; |
@@ -829,7 +830,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
829 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 830 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
830 | } | 831 | } |
831 | m_items.LockItemsForWrite(false); | 832 | m_items.LockItemsForWrite(false); |
832 | 833 | m_part.AggregateInnerPerms(); | |
833 | m_inventorySerial++; | 834 | m_inventorySerial++; |
834 | } | 835 | } |
835 | 836 | ||
@@ -943,8 +944,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
943 | 944 | ||
944 | group.SetGroup(m_part.GroupID, null); | 945 | group.SetGroup(m_part.GroupID, null); |
945 | 946 | ||
946 | // TODO: Remove magic number badness | 947 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) |
947 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
948 | { | 948 | { |
949 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 949 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
950 | { | 950 | { |
@@ -964,10 +964,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | 964 | ||
965 | foreach (SceneObjectPart part in partList) | 965 | foreach (SceneObjectPart part in partList) |
966 | { | 966 | { |
967 | // TODO: Remove magic number badness | 967 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) |
968 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
969 | { | 968 | { |
970 | part.LastOwnerID = part.OwnerID; | 969 | if(part.GroupID != part.OwnerID) |
970 | part.LastOwnerID = part.OwnerID; | ||
971 | part.OwnerID = item.OwnerID; | 971 | part.OwnerID = item.OwnerID; |
972 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 972 | part.Inventory.ChangeInventoryOwner(item.OwnerID); |
973 | } | 973 | } |
@@ -981,6 +981,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
981 | } | 981 | } |
982 | // old code end | 982 | // old code end |
983 | rootPart.TrimPermissions(); | 983 | rootPart.TrimPermissions(); |
984 | group.AggregateDeepPerms(); | ||
984 | } | 985 | } |
985 | 986 | ||
986 | return true; | 987 | return true; |
@@ -1022,16 +1023,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1022 | item.AssetID = m_items[item.ItemID].AssetID; | 1023 | item.AssetID = m_items[item.ItemID].AssetID; |
1023 | 1024 | ||
1024 | m_items[item.ItemID] = item; | 1025 | m_items[item.ItemID] = item; |
1026 | |||
1025 | m_inventorySerial++; | 1027 | m_inventorySerial++; |
1026 | if (fireScriptEvents) | 1028 | if (fireScriptEvents) |
1027 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 1029 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
1028 | 1030 | ||
1029 | if (considerChanged) | 1031 | if (considerChanged) |
1030 | { | 1032 | { |
1033 | m_part.AggregateInnerPerms(); | ||
1034 | m_part.ParentGroup.AggregatePerms(); | ||
1031 | HasInventoryChanged = true; | 1035 | HasInventoryChanged = true; |
1032 | m_part.ParentGroup.HasGroupChanged = true; | 1036 | m_part.ParentGroup.HasGroupChanged = true; |
1033 | } | 1037 | } |
1034 | m_items.LockItemsForWrite(false); | 1038 | m_items.LockItemsForWrite(false); |
1039 | |||
1035 | return true; | 1040 | return true; |
1036 | } | 1041 | } |
1037 | else | 1042 | else |
@@ -1068,6 +1073,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1068 | m_items.LockItemsForWrite(true); | 1073 | m_items.LockItemsForWrite(true); |
1069 | m_items.Remove(itemID); | 1074 | m_items.Remove(itemID); |
1070 | m_items.LockItemsForWrite(false); | 1075 | m_items.LockItemsForWrite(false); |
1076 | |||
1077 | m_part.AggregateInnerPerms(); | ||
1078 | m_part.ParentGroup.AggregatePerms(); | ||
1079 | |||
1071 | m_inventorySerial++; | 1080 | m_inventorySerial++; |
1072 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 1081 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
1073 | 1082 | ||
@@ -1170,7 +1179,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1170 | foreach (TaskInventoryItem item in m_items.Values) | 1179 | foreach (TaskInventoryItem item in m_items.Values) |
1171 | { | 1180 | { |
1172 | UUID ownerID = item.OwnerID; | 1181 | UUID ownerID = item.OwnerID; |
1173 | uint everyoneMask = 0; | 1182 | uint everyoneMask = item.EveryonePermissions; |
1174 | uint baseMask = item.BasePermissions; | 1183 | uint baseMask = item.BasePermissions; |
1175 | uint ownerMask = item.CurrentPermissions; | 1184 | uint ownerMask = item.CurrentPermissions; |
1176 | uint groupMask = item.GroupPermissions; | 1185 | uint groupMask = item.GroupPermissions; |
@@ -1319,6 +1328,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1319 | } | 1328 | } |
1320 | } | 1329 | } |
1321 | 1330 | ||
1331 | public void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone) | ||
1332 | { | ||
1333 | foreach (TaskInventoryItem item in m_items.Values) | ||
1334 | { | ||
1335 | owner &= item.CurrentPermissions; | ||
1336 | group &= item.GroupPermissions; | ||
1337 | everyone &= item.EveryonePermissions; | ||
1338 | } | ||
1339 | } | ||
1340 | |||
1322 | public uint MaskEffectivePermissions() | 1341 | public uint MaskEffectivePermissions() |
1323 | { | 1342 | { |
1324 | uint mask=0x7fffffff; | 1343 | uint mask=0x7fffffff; |