aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2011-01-12 21:39:13 +0000
committerMelanie2011-01-12 21:39:13 +0000
commit914e4b319ee0adba72bfbfebd878827bfdfde843 (patch)
tree5e48c12157f98fe2529f9c5c7781bc18488266c8 /OpenSim/Region
parentUse ToString() rather than a cast (more robust) (diff)
downloadopensim-SC-914e4b319ee0adba72bfbfebd878827bfdfde843.zip
opensim-SC-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.gz
opensim-SC-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.bz2
opensim-SC-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.xz
Fix direct item give permissions
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs26
-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, 73 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 1ebccd1..f2cc16c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -434,10 +434,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
434 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 434 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
435 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 435 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
436 436
437 // Magic number badness. Maybe this deserves an enum. 437 item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
438 // bit 4 (16) is the "Slam" bit, it means treat as passed
439 // and apply next owner perms on rez
440 item.CurrentPermissions |= 16; // Slam!
441 } 438 }
442 else 439 else
443 { 440 {
@@ -641,7 +638,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
641 rootPart.Description = item.Description; 638 rootPart.Description = item.Description;
642 639
643 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 640 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
644 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) 641 if ((rootPart.OwnerID != item.Owner) ||
642 (item.CurrentPermissions & 16) != 0 || // Magic number
643 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
645 { 644 {
646 //Need to kill the for sale here 645 //Need to kill the for sale here
647 rootPart.ObjectSaleType = 0; 646 rootPart.ObjectSaleType = 0;
@@ -651,9 +650,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
651 { 650 {
652 foreach (SceneObjectPart part in group.Parts) 651 foreach (SceneObjectPart part in group.Parts)
653 { 652 {
654 part.EveryoneMask = item.EveryOnePermissions; 653 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
655 part.NextOwnerMask = item.NextPermissions; 654 part.EveryoneMask = item.EveryOnePermissions;
656 part.GroupMask = 0; // DO NOT propagate here 655 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
656 part.NextOwnerMask = item.NextPermissions;
657 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
658 part.GroupMask = item.GroupPermissions;
657 } 659 }
658 660
659 group.ApplyNextOwnerPermissions(); 661 group.ApplyNextOwnerPermissions();
@@ -669,8 +671,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
669 part.Inventory.ChangeInventoryOwner(item.Owner); 671 part.Inventory.ChangeInventoryOwner(item.Owner);
670 part.GroupMask = 0; // DO NOT propagate here 672 part.GroupMask = 0; // DO NOT propagate here
671 } 673 }
672 part.EveryoneMask = item.EveryOnePermissions; 674 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
673 part.NextOwnerMask = item.NextPermissions; 675 part.EveryoneMask = item.EveryOnePermissions;
676 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
677 part.NextOwnerMask = item.NextPermissions;
678 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
679 part.GroupMask = item.GroupPermissions;
674 } 680 }
675 681
676 rootPart.TrimPermissions(); 682 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 bc6b165..19fa6c5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -326,10 +326,17 @@ namespace OpenSim.Region.Framework.Scenes
326 { 326 {
327 if (UUID.Zero == transactionID) 327 if (UUID.Zero == transactionID)
328 { 328 {
329 item.Flags = itemUpd.Flags;
329 item.Name = itemUpd.Name; 330 item.Name = itemUpd.Name;
330 item.Description = itemUpd.Description; 331 item.Description = itemUpd.Description;
332 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
333 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
331 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 334 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
335 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
336 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
332 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 337 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
338 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
339 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
333 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 340 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
334 item.GroupID = itemUpd.GroupID; 341 item.GroupID = itemUpd.GroupID;
335 item.GroupOwned = itemUpd.GroupOwned; 342 item.GroupOwned = itemUpd.GroupOwned;
@@ -344,9 +351,12 @@ namespace OpenSim.Region.Framework.Scenes
344 // TODO: Check if folder changed and move item 351 // TODO: Check if folder changed and move item
345 //item.NextPermissions = itemUpd.Folder; 352 //item.NextPermissions = itemUpd.Folder;
346 item.InvType = itemUpd.InvType; 353 item.InvType = itemUpd.InvType;
354
355 if (item.SalePrice != itemUpd.SalePrice ||
356 item.SaleType != itemUpd.SaleType)
357 item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale;
347 item.SalePrice = itemUpd.SalePrice; 358 item.SalePrice = itemUpd.SalePrice;
348 item.SaleType = itemUpd.SaleType; 359 item.SaleType = itemUpd.SaleType;
349 item.Flags = itemUpd.Flags;
350 360
351 InventoryService.UpdateItem(item); 361 InventoryService.UpdateItem(item);
352 } 362 }
@@ -527,7 +537,8 @@ namespace OpenSim.Region.Framework.Scenes
527 // Assign to the actual item. Make sure the slam bit is 537 // Assign to the actual item. Make sure the slam bit is
528 // set, if it wasn't set before. 538 // set, if it wasn't set before.
529 itemCopy.BasePermissions = basePerms; 539 itemCopy.BasePermissions = basePerms;
530 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam 540 itemCopy.CurrentPermissions = ownerPerms;
541 itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
531 542
532 itemCopy.NextPermissions = item.NextPermissions; 543 itemCopy.NextPermissions = item.NextPermissions;
533 544
@@ -1043,7 +1054,7 @@ namespace OpenSim.Region.Framework.Scenes
1043 else 1054 else
1044 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 1055 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
1045 1056
1046 agentItem.CurrentPermissions |= 16; // Slam 1057 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1047 agentItem.NextPermissions = taskItem.NextPermissions; 1058 agentItem.NextPermissions = taskItem.NextPermissions;
1048 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1059 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1049 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 1060 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1254,7 +1265,7 @@ namespace OpenSim.Region.Framework.Scenes
1254 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1265 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1255 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1266 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1256 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1267 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1257 destTaskItem.CurrentPermissions |= 16; // Slam! 1268 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1258 } 1269 }
1259 } 1270 }
1260 1271
@@ -1435,6 +1446,8 @@ namespace OpenSim.Region.Framework.Scenes
1435 // Base ALWAYS has move 1446 // Base ALWAYS has move
1436 currentItem.BasePermissions |= (uint)PermissionMask.Move; 1447 currentItem.BasePermissions |= (uint)PermissionMask.Move;
1437 1448
1449 itemInfo.Flags = currentItem.Flags;
1450
1438 // Check if we're allowed to mess with permissions 1451 // Check if we're allowed to mess with permissions
1439 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god 1452 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
1440 { 1453 {
@@ -1452,6 +1465,14 @@ namespace OpenSim.Region.Framework.Scenes
1452 // Owner can't change base, and can change other 1465 // Owner can't change base, and can change other
1453 // only up to base 1466 // only up to base
1454 itemInfo.BasePermissions = currentItem.BasePermissions; 1467 itemInfo.BasePermissions = currentItem.BasePermissions;
1468 if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
1469 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1470 if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
1471 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1472 if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
1473 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1474 if (itemInfo.NextPermissions != currentItem.NextPermissions)
1475 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1455 itemInfo.EveryonePermissions &= currentItem.BasePermissions; 1476 itemInfo.EveryonePermissions &= currentItem.BasePermissions;
1456 itemInfo.GroupPermissions &= currentItem.BasePermissions; 1477 itemInfo.GroupPermissions &= currentItem.BasePermissions;
1457 itemInfo.CurrentPermissions &= currentItem.BasePermissions; 1478 itemInfo.CurrentPermissions &= currentItem.BasePermissions;
@@ -1459,6 +1480,19 @@ namespace OpenSim.Region.Framework.Scenes
1459 } 1480 }
1460 1481
1461 } 1482 }
1483 else
1484 {
1485 if (itemInfo.BasePermissions != currentItem.BasePermissions)
1486 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
1487 if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
1488 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1489 if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
1490 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1491 if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
1492 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1493 if (itemInfo.NextPermissions != currentItem.NextPermissions)
1494 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1495 }
1462 1496
1463 // Next ALWAYS has move 1497 // Next ALWAYS has move
1464 itemInfo.NextPermissions |= (uint)PermissionMask.Move; 1498 itemInfo.NextPermissions |= (uint)PermissionMask.Move;
@@ -1667,7 +1701,7 @@ namespace OpenSim.Region.Framework.Scenes
1667 srcTaskItem.NextPermissions; 1701 srcTaskItem.NextPermissions;
1668 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1702 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1669 srcTaskItem.NextPermissions; 1703 srcTaskItem.NextPermissions;
1670 destTaskItem.CurrentPermissions |= 16; // Slam! 1704 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1671 } 1705 }
1672 } 1706 }
1673 1707
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 982e280..e8095c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
122 taskItem.NextPermissions = item.NextPermissions; 122 taskItem.NextPermissions = item.NextPermissions;
123 // We're adding this to a prim we don't own. Force 123 // We're adding this to a prim we don't own. Force
124 // owner change 124 // owner change
125 taskItem.CurrentPermissions |= 16; // Slam 125 taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
126 } 126 }
127 else 127 else
128 { 128 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 900130a..91bb3a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -629,14 +629,19 @@ namespace OpenSim.Region.Framework.Scenes
629 629
630 group.SetGroup(m_part.GroupID, null); 630 group.SetGroup(m_part.GroupID, null);
631 631
632 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 632 // TODO: Remove magic number badness
633 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
633 { 634 {
634 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) 635 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
635 { 636 {
636 foreach (SceneObjectPart part in partList) 637 foreach (SceneObjectPart part in partList)
637 { 638 {
638 part.EveryoneMask = item.EveryonePermissions; 639 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
639 part.NextOwnerMask = item.NextPermissions; 640 part.EveryoneMask = item.EveryonePermissions;
641 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
642 part.NextOwnerMask = item.NextPermissions;
643 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
644 part.GroupMask = item.GroupPermissions;
640 } 645 }
641 646
642 group.ApplyNextOwnerPermissions(); 647 group.ApplyNextOwnerPermissions();
@@ -645,15 +650,20 @@ namespace OpenSim.Region.Framework.Scenes
645 650
646 foreach (SceneObjectPart part in partList) 651 foreach (SceneObjectPart part in partList)
647 { 652 {
648 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 653 // TODO: Remove magic number badness
654 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
649 { 655 {
650 part.LastOwnerID = part.OwnerID; 656 part.LastOwnerID = part.OwnerID;
651 part.OwnerID = item.OwnerID; 657 part.OwnerID = item.OwnerID;
652 part.Inventory.ChangeInventoryOwner(item.OwnerID); 658 part.Inventory.ChangeInventoryOwner(item.OwnerID);
653 } 659 }
654 660
655 part.EveryoneMask = item.EveryonePermissions; 661 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
656 part.NextOwnerMask = item.NextPermissions; 662 part.EveryoneMask = item.EveryonePermissions;
663 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
664 part.NextOwnerMask = item.NextPermissions;
665 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
666 part.GroupMask = item.GroupPermissions;
657 } 667 }
658 668
659 rootPart.TrimPermissions(); 669 rootPart.TrimPermissions();