diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6251266..fadcd5e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -439,17 +439,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
439 | 439 | ||
440 | if (item == null) | 440 | if (item == null) |
441 | return null; | 441 | return null; |
442 | |||
443 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
444 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
442 | 445 | ||
443 | // Can't know creator is the same, so null it in inventory | ||
444 | if (objlist.Count > 1) | 446 | if (objlist.Count > 1) |
445 | { | 447 | { |
446 | item.CreatorId = UUID.Zero.ToString(); | ||
447 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | 448 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
449 | |||
450 | // If the objects have different creators then don't specify a creator at all | ||
451 | foreach (SceneObjectGroup objectGroup in objlist) | ||
452 | { | ||
453 | if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId) | ||
454 | || (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData)) | ||
455 | { | ||
456 | item.CreatorId = UUID.Zero.ToString(); | ||
457 | item.CreatorData = string.Empty; | ||
458 | break; | ||
459 | } | ||
460 | } | ||
448 | } | 461 | } |
449 | else | 462 | else |
450 | { | 463 | { |
451 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
452 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
453 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | 464 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
454 | item.SalePrice = objlist[0].RootPart.SalePrice; | 465 | item.SalePrice = objlist[0].RootPart.SalePrice; |
455 | } | 466 | } |
@@ -470,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
470 | } | 481 | } |
471 | else | 482 | else |
472 | { | 483 | { |
473 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
474 | |||
475 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 484 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
476 | item.Description = asset.Description; | 485 | item.Description = asset.Description; |
477 | item.Name = asset.Name; | 486 | item.Name = asset.Name; |
478 | item.AssetType = asset.Type; | 487 | item.AssetType = asset.Type; |
479 | 488 | ||
489 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
490 | |||
480 | m_Scene.AddInventoryItem(item); | 491 | m_Scene.AddInventoryItem(item); |
481 | 492 | ||
482 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 493 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
@@ -531,16 +542,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
531 | } | 542 | } |
532 | effectivePerms |= (uint)PermissionMask.Move; | 543 | effectivePerms |= (uint)PermissionMask.Move; |
533 | 544 | ||
545 | //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
546 | |||
534 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 547 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
535 | { | 548 | { |
536 | uint perms = effectivePerms; | 549 | uint perms = effectivePerms; |
537 | uint nextPerms = (perms & 7) << 13; | 550 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
538 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
539 | perms &= ~(uint)PermissionMask.Copy; | ||
540 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
541 | perms &= ~(uint)PermissionMask.Transfer; | ||
542 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
543 | perms &= ~(uint)PermissionMask.Modify; | ||
544 | 551 | ||
545 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 552 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; |
546 | item.CurrentPermissions = item.BasePermissions; | 553 | item.CurrentPermissions = item.BasePermissions; |
@@ -548,10 +555,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
548 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | 555 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; |
549 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | 556 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; |
550 | 557 | ||
551 | // Magic number badness. Maybe this deserves an enum. | 558 | // apply next owner perms on rez |
552 | // bit 4 (16) is the "Slam" bit, it means treat as passed | 559 | item.CurrentPermissions |= SceneObjectGroup.SLAM; |
553 | // and apply next owner perms on rez | ||
554 | item.CurrentPermissions |= 16; // Slam! | ||
555 | } | 560 | } |
556 | else | 561 | else |
557 | { | 562 | { |
@@ -568,8 +573,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
568 | (uint)PermissionMask.Move | | 573 | (uint)PermissionMask.Move | |
569 | (uint)PermissionMask.Export | | 574 | (uint)PermissionMask.Export | |
570 | 7); // Preserve folded permissions | 575 | 7); // Preserve folded permissions |
571 | } | 576 | } |
572 | 577 | ||
578 | //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
579 | |||
573 | return item; | 580 | return item; |
574 | } | 581 | } |
575 | 582 | ||
@@ -864,11 +871,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
864 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; | 871 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; |
865 | } | 872 | } |
866 | 873 | ||
867 | foreach (SceneObjectPart part in group.Parts) | 874 | if (item == null) |
868 | { | 875 | { |
869 | // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. | 876 | // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here. |
870 | part.LastOwnerID = part.OwnerID; | 877 | foreach (SceneObjectPart part in group.Parts) |
871 | part.OwnerID = remoteClient.AgentId; | 878 | { |
879 | // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. | ||
880 | part.LastOwnerID = part.OwnerID; | ||
881 | part.OwnerID = remoteClient.AgentId; | ||
882 | } | ||
872 | } | 883 | } |
873 | 884 | ||
874 | if (!attachment) | 885 | if (!attachment) |
@@ -1077,7 +1088,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1077 | part.GroupMask = item.GroupPermissions; | 1088 | part.GroupMask = item.GroupPermissions; |
1078 | } | 1089 | } |
1079 | } | 1090 | } |
1080 | 1091 | ||
1081 | rootPart.TrimPermissions(); | 1092 | rootPart.TrimPermissions(); |
1082 | 1093 | ||
1083 | if (isAttachment) | 1094 | if (isAttachment) |