diff options
author | Melanie | 2010-07-13 20:45:16 +0100 |
---|---|---|
committer | Melanie | 2010-07-13 20:45:16 +0100 |
commit | dd14016885d9c9a411ffc19b0afb0a6771d47cad (patch) | |
tree | 872758572e7aa7322965d4f0cbbc8b1fa52b307a /OpenSim/Region/CoreModules | |
parent | Add CreateSelected flag onto objects rezzed from inventory (diff) | |
download | opensim-SC-dd14016885d9c9a411ffc19b0afb0a6771d47cad.zip opensim-SC-dd14016885d9c9a411ffc19b0afb0a6771d47cad.tar.gz opensim-SC-dd14016885d9c9a411ffc19b0afb0a6771d47cad.tar.bz2 opensim-SC-dd14016885d9c9a411ffc19b0afb0a6771d47cad.tar.xz |
Revamp the permissions propagation. This MAY mess up. Please test.
Change the slam bit from 3 to 4. Assume the old slam bit is always set.
The new slam bit is a "changed owner" bit, correcting a bug where an item
passed from the creator to another with less than full perms, then back (sale
test) would arrive back full perm. Lots of in-code docs.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index e5f1e70..1a7da61 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -381,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
381 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | 381 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) |
382 | perms &= ~(uint)PermissionMask.Modify; | 382 | perms &= ~(uint)PermissionMask.Modify; |
383 | 383 | ||
384 | // Make sure all bits but the ones we want are clear | ||
385 | // on take. | ||
386 | // This will be applied to the current perms, so | ||
387 | // it will do what we want. | ||
388 | objectGroup.RootPart.NextOwnerMask &= | ||
389 | ((uint)PermissionMask.Copy | | ||
390 | (uint)PermissionMask.Transfer | | ||
391 | (uint)PermissionMask.Modify); | ||
392 | objectGroup.RootPart.NextOwnerMask |= | ||
393 | (uint)PermissionMask.Move; | ||
394 | |||
384 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | 395 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; |
385 | item.CurrentPermissions = item.BasePermissions; | 396 | item.CurrentPermissions = item.BasePermissions; |
386 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 397 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
387 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | 398 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; |
388 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | 399 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; |
389 | item.CurrentPermissions |= 8; // Slam! | 400 | |
401 | // Magic number badness. Maybe this deserves an enum. | ||
402 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
403 | // and apply next owner perms on rez | ||
404 | item.CurrentPermissions |= 16; // Slam! | ||
390 | } | 405 | } |
391 | else | 406 | else |
392 | { | 407 | { |
@@ -396,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
396 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | 411 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; |
397 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | 412 | item.GroupPermissions = objectGroup.RootPart.GroupMask; |
398 | 413 | ||
399 | item.CurrentPermissions |= 8; // Slam! | 414 | item.CurrentPermissions &= |
415 | ((uint)PermissionMask.Copy | | ||
416 | (uint)PermissionMask.Transfer | | ||
417 | (uint)PermissionMask.Modify | | ||
418 | (uint)PermissionMask.Move | | ||
419 | 7); // Preserve folded permissions | ||
400 | } | 420 | } |
401 | 421 | ||
402 | // TODO: add the new fields (Flags, Sale info, etc) | 422 | // TODO: add the new fields (Flags, Sale info, etc) |
@@ -498,7 +518,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
498 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | 518 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); |
499 | 519 | ||
500 | group.RootPart.FromFolderID = item.Folder; | 520 | group.RootPart.FromFolderID = item.Folder; |
501 | group.RootPart.CreateSelected = true | 521 | |
522 | // If it's rezzed in world, select it. Much easier to | ||
523 | // find small items. | ||
524 | // | ||
525 | if (!attachment) | ||
526 | group.RootPart.CreateSelected = true; | ||
502 | 527 | ||
503 | if (!m_Scene.Permissions.CanRezObject( | 528 | if (!m_Scene.Permissions.CanRezObject( |
504 | group.Children.Count, remoteClient.AgentId, pos) | 529 | group.Children.Count, remoteClient.AgentId, pos) |
@@ -572,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
572 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | 597 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); |
573 | 598 | ||
574 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 599 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
575 | if (rootPart.OwnerID != item.Owner) | 600 | if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) |
576 | { | 601 | { |
577 | //Need to kill the for sale here | 602 | //Need to kill the for sale here |
578 | rootPart.ObjectSaleType = 0; | 603 | rootPart.ObjectSaleType = 0; |
@@ -580,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
580 | 605 | ||
581 | if (m_Scene.Permissions.PropagatePermissions()) | 606 | if (m_Scene.Permissions.PropagatePermissions()) |
582 | { | 607 | { |
583 | if ((item.CurrentPermissions & 8) != 0) | 608 | foreach (SceneObjectPart part in partList) |
584 | { | 609 | { |
585 | foreach (SceneObjectPart part in partList) | 610 | part.EveryoneMask = item.EveryOnePermissions; |
586 | { | 611 | part.NextOwnerMask = item.NextPermissions; |
587 | part.EveryoneMask = item.EveryOnePermissions; | 612 | part.GroupMask = 0; // DO NOT propagate here |
588 | part.NextOwnerMask = item.NextPermissions; | ||
589 | part.GroupMask = 0; // DO NOT propagate here | ||
590 | } | ||
591 | } | 613 | } |
592 | 614 | ||
593 | group.ApplyNextOwnerPermissions(); | 615 | group.ApplyNextOwnerPermissions(); |
@@ -596,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
596 | 618 | ||
597 | foreach (SceneObjectPart part in partList) | 619 | foreach (SceneObjectPart part in partList) |
598 | { | 620 | { |
599 | if (part.OwnerID != item.Owner) | 621 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) |
600 | { | 622 | { |
601 | part.LastOwnerID = part.OwnerID; | 623 | part.LastOwnerID = part.OwnerID; |
602 | part.OwnerID = item.Owner; | 624 | part.OwnerID = item.Owner; |
603 | part.Inventory.ChangeInventoryOwner(item.Owner); | 625 | part.Inventory.ChangeInventoryOwner(item.Owner); |
604 | } | ||
605 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | ||
606 | { | ||
607 | part.EveryoneMask = item.EveryOnePermissions; | ||
608 | part.NextOwnerMask = item.NextPermissions; | ||
609 | |||
610 | part.GroupMask = 0; // DO NOT propagate here | 626 | part.GroupMask = 0; // DO NOT propagate here |
611 | } | 627 | } |
628 | part.EveryoneMask = item.EveryOnePermissions; | ||
629 | part.NextOwnerMask = item.NextPermissions; | ||
612 | } | 630 | } |
613 | 631 | ||
614 | rootPart.TrimPermissions(); | 632 | rootPart.TrimPermissions(); |