diff options
author | Melanie | 2011-01-12 21:39:13 +0000 |
---|---|---|
committer | Melanie | 2011-01-12 21:39:13 +0000 |
commit | 914e4b319ee0adba72bfbfebd878827bfdfde843 (patch) | |
tree | 5e48c12157f98fe2529f9c5c7781bc18488266c8 /OpenSim/Region/Framework | |
parent | Use ToString() rather than a cast (more robust) (diff) | |
download | opensim-SC_OLD-914e4b319ee0adba72bfbfebd878827bfdfde843.zip opensim-SC_OLD-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.gz opensim-SC_OLD-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.bz2 opensim-SC_OLD-914e4b319ee0adba72bfbfebd878827bfdfde843.tar.xz |
Fix direct item give permissions
Diffstat (limited to 'OpenSim/Region/Framework')
3 files changed, 56 insertions, 12 deletions
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(); |