aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-01-12 16:20:38 +0100
committerMelanie2011-01-12 16:20:38 +0100
commit7f99a8c900251c59bc7cb7d8309a14ad5360de42 (patch)
tree3859626c6eb4f2f8d05fcbc7f0a7c270671fcecd /OpenSim
parentRemove old guids from the examples, for completeness' sake (diff)
downloadopensim-SC_OLD-7f99a8c900251c59bc7cb7d8309a14ad5360de42.zip
opensim-SC_OLD-7f99a8c900251c59bc7cb7d8309a14ad5360de42.tar.gz
opensim-SC_OLD-7f99a8c900251c59bc7cb7d8309a14ad5360de42.tar.bz2
opensim-SC_OLD-7f99a8c900251c59bc7cb7d8309a14ad5360de42.tar.xz
Fix direct item give permissions
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs22
5 files changed, 76 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 623cd3a..10e74ea 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -511,10 +511,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
511 item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; 511 item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
512 item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; 512 item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
513 513
514 // Magic number badness. Maybe this deserves an enum. 514 item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
515 // bit 4 (16) is the "Slam" bit, it means treat as passed
516 // and apply next owner perms on rez
517 item.CurrentPermissions |= 16; // Slam!
518 } 515 }
519 else 516 else
520 { 517 {
@@ -794,8 +791,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
794 } 791 }
795 792
796 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 793 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
794 // TODO: Remove the magic number badness
797 if ((rootPart.OwnerID != item.Owner) || 795 if ((rootPart.OwnerID != item.Owner) ||
798 (item.CurrentPermissions & 16) != 0) 796 (item.CurrentPermissions & 16) != 0 || // Magic number
797 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
799 { 798 {
800 //Need to kill the for sale here 799 //Need to kill the for sale here
801 rootPart.ObjectSaleType = 0; 800 rootPart.ObjectSaleType = 0;
@@ -807,10 +806,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
807 { 806 {
808 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) 807 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
809 { 808 {
810 part.EveryoneMask = item.EveryOnePermissions; 809 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
811 part.NextOwnerMask = item.NextPermissions; 810 part.EveryoneMask = item.EveryOnePermissions;
811 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
812 part.NextOwnerMask = item.NextPermissions;
813 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
814 part.GroupMask = item.GroupPermissions;
812 } 815 }
813 part.GroupMask = 0; // DO NOT propagate here
814 } 816 }
815 817
816 group.ApplyNextOwnerPermissions(); 818 group.ApplyNextOwnerPermissions();
@@ -819,16 +821,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
819 821
820 foreach (SceneObjectPart part in group.Parts) 822 foreach (SceneObjectPart part in group.Parts)
821 { 823 {
824 // TODO: Remove the magic number badness
822 if ((part.OwnerID != item.Owner) || 825 if ((part.OwnerID != item.Owner) ||
823 (item.CurrentPermissions & 16) != 0) 826 (item.CurrentPermissions & 16) != 0 || // Magic number
827 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
824 { 828 {
825 part.LastOwnerID = part.OwnerID; 829 part.LastOwnerID = part.OwnerID;
826 part.OwnerID = item.Owner; 830 part.OwnerID = item.Owner;
827 part.Inventory.ChangeInventoryOwner(item.Owner); 831 part.Inventory.ChangeInventoryOwner(item.Owner);
828 part.GroupMask = 0; // DO NOT propagate here
829 } 832 }
830 part.EveryoneMask = item.EveryOnePermissions; 833 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
831 part.NextOwnerMask = item.NextPermissions; 834 part.EveryoneMask = item.EveryOnePermissions;
835 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
836 part.NextOwnerMask = item.NextPermissions;
837 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
838 part.GroupMask = item.GroupPermissions;
832 } 839 }
833 840
834 rootPart.TrimPermissions(); 841 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 568ba19..be399ff 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
215 part.NextOwnerMask; 215 part.NextOwnerMask;
216 item.GroupPermissions = part.GroupMask & 216 item.GroupPermissions = part.GroupMask &
217 part.NextOwnerMask; 217 part.NextOwnerMask;
218 item.CurrentPermissions |= 16; // Slam! 218 item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
219 item.CreationDate = Util.UnixTimeSinceEpoch(); 219 item.CreationDate = Util.UnixTimeSinceEpoch();
220 220
221 if (m_scene.AddInventoryItem(item)) 221 if (m_scene.AddInventoryItem(item))
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 1f32362..7216b39 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -308,10 +308,17 @@ namespace OpenSim.Region.Framework.Scenes
308 { 308 {
309 if (UUID.Zero == transactionID) 309 if (UUID.Zero == transactionID)
310 { 310 {
311 item.Flags = itemUpd.Flags;
311 item.Name = itemUpd.Name; 312 item.Name = itemUpd.Name;
312 item.Description = itemUpd.Description; 313 item.Description = itemUpd.Description;
314 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
315 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
313 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 316 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
317 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
318 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
314 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 319 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
320 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
321 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
315 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 322 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
316 item.GroupID = itemUpd.GroupID; 323 item.GroupID = itemUpd.GroupID;
317 item.GroupOwned = itemUpd.GroupOwned; 324 item.GroupOwned = itemUpd.GroupOwned;
@@ -326,9 +333,12 @@ namespace OpenSim.Region.Framework.Scenes
326 // TODO: Check if folder changed and move item 333 // TODO: Check if folder changed and move item
327 //item.NextPermissions = itemUpd.Folder; 334 //item.NextPermissions = itemUpd.Folder;
328 item.InvType = itemUpd.InvType; 335 item.InvType = itemUpd.InvType;
336
337 if (item.SalePrice != itemUpd.SalePrice ||
338 item.SaleType != itemUpd.SaleType)
339 item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale;
329 item.SalePrice = itemUpd.SalePrice; 340 item.SalePrice = itemUpd.SalePrice;
330 item.SaleType = itemUpd.SaleType; 341 item.SaleType = itemUpd.SaleType;
331 item.Flags = itemUpd.Flags;
332 342
333 InventoryService.UpdateItem(item); 343 InventoryService.UpdateItem(item);
334 } 344 }
@@ -509,7 +519,8 @@ namespace OpenSim.Region.Framework.Scenes
509 // Assign to the actual item. Make sure the slam bit is 519 // Assign to the actual item. Make sure the slam bit is
510 // set, if it wasn't set before. 520 // set, if it wasn't set before.
511 itemCopy.BasePermissions = basePerms; 521 itemCopy.BasePermissions = basePerms;
512 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam 522 itemCopy.CurrentPermissions = ownerPerms;
523 itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
513 524
514 itemCopy.NextPermissions = item.NextPermissions; 525 itemCopy.NextPermissions = item.NextPermissions;
515 526
@@ -1049,7 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes
1049 else 1060 else
1050 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 1061 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
1051 1062
1052 agentItem.CurrentPermissions |= 16; // Slam 1063 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1053 agentItem.NextPermissions = taskItem.NextPermissions; 1064 agentItem.NextPermissions = taskItem.NextPermissions;
1054 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1065 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1055 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 1066 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1260,7 +1271,7 @@ namespace OpenSim.Region.Framework.Scenes
1260 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1271 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1261 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1272 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1262 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1273 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1263 destTaskItem.CurrentPermissions |= 16; // Slam! 1274 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1264 } 1275 }
1265 } 1276 }
1266 1277
@@ -1434,6 +1445,8 @@ namespace OpenSim.Region.Framework.Scenes
1434 // Base ALWAYS has move 1445 // Base ALWAYS has move
1435 currentItem.BasePermissions |= (uint)PermissionMask.Move; 1446 currentItem.BasePermissions |= (uint)PermissionMask.Move;
1436 1447
1448 itemInfo.Flags = currentItem.Flags;
1449
1437 // Check if we're allowed to mess with permissions 1450 // Check if we're allowed to mess with permissions
1438 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god 1451 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
1439 { 1452 {
@@ -1451,6 +1464,14 @@ namespace OpenSim.Region.Framework.Scenes
1451 // Owner can't change base, and can change other 1464 // Owner can't change base, and can change other
1452 // only up to base 1465 // only up to base
1453 itemInfo.BasePermissions = currentItem.BasePermissions; 1466 itemInfo.BasePermissions = currentItem.BasePermissions;
1467 if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
1468 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1469 if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
1470 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1471 if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
1472 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1473 if (itemInfo.NextPermissions != currentItem.NextPermissions)
1474 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1454 itemInfo.EveryonePermissions &= currentItem.BasePermissions; 1475 itemInfo.EveryonePermissions &= currentItem.BasePermissions;
1455 itemInfo.GroupPermissions &= currentItem.BasePermissions; 1476 itemInfo.GroupPermissions &= currentItem.BasePermissions;
1456 itemInfo.CurrentPermissions &= currentItem.BasePermissions; 1477 itemInfo.CurrentPermissions &= currentItem.BasePermissions;
@@ -1458,6 +1479,19 @@ namespace OpenSim.Region.Framework.Scenes
1458 } 1479 }
1459 1480
1460 } 1481 }
1482 else
1483 {
1484 if (itemInfo.BasePermissions != currentItem.BasePermissions)
1485 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
1486 if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
1487 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1488 if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
1489 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1490 if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
1491 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1492 if (itemInfo.NextPermissions != currentItem.NextPermissions)
1493 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1494 }
1461 1495
1462 // Next ALWAYS has move 1496 // Next ALWAYS has move
1463 itemInfo.NextPermissions |= (uint)PermissionMask.Move; 1497 itemInfo.NextPermissions |= (uint)PermissionMask.Move;
@@ -1666,7 +1700,7 @@ namespace OpenSim.Region.Framework.Scenes
1666 srcTaskItem.NextPermissions; 1700 srcTaskItem.NextPermissions;
1667 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1701 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1668 srcTaskItem.NextPermissions; 1702 srcTaskItem.NextPermissions;
1669 destTaskItem.CurrentPermissions |= 16; // Slam! 1703 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1670 } 1704 }
1671 } 1705 }
1672 1706
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 50521c4..0b545c4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes
118 taskItem.NextPermissions = item.NextPermissions; 118 taskItem.NextPermissions = item.NextPermissions;
119 // We're adding this to a prim we don't own. Force 119 // We're adding this to a prim we don't own. Force
120 // owner change 120 // owner change
121 taskItem.CurrentPermissions |= 16; // Slam 121 taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
122 } 122 }
123 else 123 else
124 { 124 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3b1ab01..8761284 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -815,14 +815,19 @@ namespace OpenSim.Region.Framework.Scenes
815 815
816 group.SetGroup(m_part.GroupID, null); 816 group.SetGroup(m_part.GroupID, null);
817 817
818 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 818 // TODO: Remove magic number badness
819 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
819 { 820 {
820 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) 821 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
821 { 822 {
822 foreach (SceneObjectPart part in partList) 823 foreach (SceneObjectPart part in partList)
823 { 824 {
824 part.EveryoneMask = item.EveryonePermissions; 825 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
825 part.NextOwnerMask = item.NextPermissions; 826 part.EveryoneMask = item.EveryonePermissions;
827 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
828 part.NextOwnerMask = item.NextPermissions;
829 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
830 part.GroupMask = item.GroupPermissions;
826 } 831 }
827 832
828 group.ApplyNextOwnerPermissions(); 833 group.ApplyNextOwnerPermissions();
@@ -831,15 +836,20 @@ namespace OpenSim.Region.Framework.Scenes
831 836
832 foreach (SceneObjectPart part in partList) 837 foreach (SceneObjectPart part in partList)
833 { 838 {
834 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 839 // TODO: Remove magic number badness
840 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
835 { 841 {
836 part.LastOwnerID = part.OwnerID; 842 part.LastOwnerID = part.OwnerID;
837 part.OwnerID = item.OwnerID; 843 part.OwnerID = item.OwnerID;
838 part.Inventory.ChangeInventoryOwner(item.OwnerID); 844 part.Inventory.ChangeInventoryOwner(item.OwnerID);
839 } 845 }
840 846
841 part.EveryoneMask = item.EveryonePermissions; 847 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
842 part.NextOwnerMask = item.NextPermissions; 848 part.EveryoneMask = item.EveryonePermissions;
849 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
850 part.NextOwnerMask = item.NextPermissions;
851 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
852 part.GroupMask = item.GroupPermissions;
843 } 853 }
844 854
845 rootPart.TrimPermissions(); 855 rootPart.TrimPermissions();