aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorRobert Adams2014-01-11 08:52:23 -0800
committerRobert Adams2014-01-11 08:52:23 -0800
commit1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f (patch)
tree125392101f83c8e7cb239848ae7a6cc12595b1a2 /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' into varregion (diff)
parentFix crash in BulletSim which sometimes happens making a linkset physical (diff)
downloadopensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.zip
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.gz
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.bz2
opensim-SC_OLD-1cf17a3cf7322b79d44ef80b9129c975f0cf4f6f.tar.xz
Merge branch 'master' into varregion
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/SceneBase.cs OpenSim/Services/Interfaces/IGridService.cs OpenSim/Services/LLLoginService/LLLoginResponse.cs (conflicts were debug statements that are commented out in master branch)
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs115
1 files changed, 55 insertions, 60 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 831922e..781cc69 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -412,17 +412,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
412 412
413 if (item == null) 413 if (item == null)
414 return null; 414 return null;
415
416 item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
417 item.CreatorData = objlist[0].RootPart.CreatorData;
415 418
416 // Can't know creator is the same, so null it in inventory
417 if (objlist.Count > 1) 419 if (objlist.Count > 1)
418 { 420 {
419 item.CreatorId = UUID.Zero.ToString();
420 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; 421 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
422
423 // If the objects have different creators then don't specify a creator at all
424 foreach (SceneObjectGroup objectGroup in objlist)
425 {
426 if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId)
427 || (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData))
428 {
429 item.CreatorId = UUID.Zero.ToString();
430 item.CreatorData = string.Empty;
431 break;
432 }
433 }
421 } 434 }
422 else 435 else
423 { 436 {
424 item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
425 item.CreatorData = objlist[0].RootPart.CreatorData;
426 item.SaleType = objlist[0].RootPart.ObjectSaleType; 437 item.SaleType = objlist[0].RootPart.ObjectSaleType;
427 item.SalePrice = objlist[0].RootPart.SalePrice; 438 item.SalePrice = objlist[0].RootPart.SalePrice;
428 } 439 }
@@ -443,13 +454,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
443 } 454 }
444 else 455 else
445 { 456 {
446 AddPermissions(item, objlist[0], objlist, remoteClient);
447
448 item.CreationDate = Util.UnixTimeSinceEpoch(); 457 item.CreationDate = Util.UnixTimeSinceEpoch();
449 item.Description = asset.Description; 458 item.Description = asset.Description;
450 item.Name = asset.Name; 459 item.Name = asset.Name;
451 item.AssetType = asset.Type; 460 item.AssetType = asset.Type;
452 461
462 AddPermissions(item, objlist[0], objlist, remoteClient);
463
453 m_Scene.AddInventoryItem(item); 464 m_Scene.AddInventoryItem(item);
454 465
455 if (remoteClient != null && item.Owner == remoteClient.AgentId) 466 if (remoteClient != null && item.Owner == remoteClient.AgentId)
@@ -491,39 +502,42 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
491 IClientAPI remoteClient) 502 IClientAPI remoteClient)
492 { 503 {
493 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 504 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
505 uint allObjectsNextOwnerPerms = 0x7fffffff;
506 uint allObjectsEveryOnePerms = 0x7fffffff;
507 uint allObjectsGroupPerms = 0x7fffffff;
508
494 foreach (SceneObjectGroup grp in objsForEffectivePermissions) 509 foreach (SceneObjectGroup grp in objsForEffectivePermissions)
510 {
495 effectivePerms &= grp.GetEffectivePermissions(); 511 effectivePerms &= grp.GetEffectivePermissions();
512 allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask;
513 allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask;
514 allObjectsGroupPerms &= grp.RootPart.GroupMask;
515 }
496 effectivePerms |= (uint)PermissionMask.Move; 516 effectivePerms |= (uint)PermissionMask.Move;
497 517
518 //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
519
498 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) 520 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
499 { 521 {
500 uint perms = effectivePerms; 522 uint perms = effectivePerms;
501 uint nextPerms = (perms & 7) << 13; 523 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
502 if ((nextPerms & (uint)PermissionMask.Copy) == 0) 524
503 perms &= ~(uint)PermissionMask.Copy; 525 item.BasePermissions = perms & allObjectsNextOwnerPerms;
504 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
505 perms &= ~(uint)PermissionMask.Transfer;
506 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
507 perms &= ~(uint)PermissionMask.Modify;
508
509 item.BasePermissions = perms & so.RootPart.NextOwnerMask;
510 item.CurrentPermissions = item.BasePermissions; 526 item.CurrentPermissions = item.BasePermissions;
511 item.NextPermissions = perms & so.RootPart.NextOwnerMask; 527 item.NextPermissions = perms & allObjectsNextOwnerPerms;
512 item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; 528 item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms;
513 item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; 529 item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms;
514 530
515 // Magic number badness. Maybe this deserves an enum. 531 // apply next owner perms on rez
516 // bit 4 (16) is the "Slam" bit, it means treat as passed 532 item.CurrentPermissions |= SceneObjectGroup.SLAM;
517 // and apply next owner perms on rez
518 item.CurrentPermissions |= 16; // Slam!
519 } 533 }
520 else 534 else
521 { 535 {
522 item.BasePermissions = effectivePerms; 536 item.BasePermissions = effectivePerms;
523 item.CurrentPermissions = effectivePerms; 537 item.CurrentPermissions = effectivePerms;
524 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; 538 item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms;
525 item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; 539 item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms;
526 item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; 540 item.GroupPermissions = allObjectsGroupPerms & effectivePerms;
527 541
528 item.CurrentPermissions &= 542 item.CurrentPermissions &=
529 ((uint)PermissionMask.Copy | 543 ((uint)PermissionMask.Copy |
@@ -532,8 +546,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
532 (uint)PermissionMask.Move | 546 (uint)PermissionMask.Move |
533 (uint)PermissionMask.Export | 547 (uint)PermissionMask.Export |
534 7); // Preserve folded permissions 548 7); // Preserve folded permissions
535 } 549 }
536 550
551 //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
552
537 return item; 553 return item;
538 } 554 }
539 555
@@ -809,11 +825,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
809 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; 825 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
810 } 826 }
811 827
812 foreach (SceneObjectPart part in group.Parts) 828 if (item == null)
813 { 829 {
814 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. 830 // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here.
815 part.LastOwnerID = part.OwnerID; 831 foreach (SceneObjectPart part in group.Parts)
816 part.OwnerID = remoteClient.AgentId; 832 {
833 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
834 part.LastOwnerID = part.OwnerID;
835 part.OwnerID = remoteClient.AgentId;
836 }
817 } 837 }
818 838
819 if (!attachment) 839 if (!attachment)
@@ -969,44 +989,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
969// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", 989// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
970// rootPart.OwnerID, item.Owner, item.CurrentPermissions); 990// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
971 991
972 if ((rootPart.OwnerID != item.Owner) || 992 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0)
973 (item.CurrentPermissions & 16) != 0)
974 { 993 {
975 //Need to kill the for sale here 994 //Need to kill the for sale here
976 rootPart.ObjectSaleType = 0; 995 rootPart.ObjectSaleType = 0;
977 rootPart.SalePrice = 10; 996 rootPart.SalePrice = 10;
978
979 if (m_Scene.Permissions.PropagatePermissions())
980 {
981 foreach (SceneObjectPart part in so.Parts)
982 {
983 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
984 {
985 part.EveryoneMask = item.EveryOnePermissions;
986 part.NextOwnerMask = item.NextPermissions;
987 }
988 part.GroupMask = 0; // DO NOT propagate here
989 }
990
991 so.ApplyNextOwnerPermissions();
992 }
993 } 997 }
994 998
995 foreach (SceneObjectPart part in so.Parts) 999 foreach (SceneObjectPart part in so.Parts)
996 { 1000 {
997 part.FromUserInventoryItemID = fromUserInventoryItemId; 1001 part.FromUserInventoryItemID = fromUserInventoryItemId;
998 1002 part.ApplyPermissionsOnRez(item, true, m_Scene);
999 if ((part.OwnerID != item.Owner) ||
1000 (item.CurrentPermissions & 16) != 0)
1001 {
1002 part.Inventory.ChangeInventoryOwner(item.Owner);
1003 part.GroupMask = 0; // DO NOT propagate here
1004 }
1005
1006 part.EveryoneMask = item.EveryOnePermissions;
1007 part.NextOwnerMask = item.NextPermissions;
1008 } 1003 }
1009 1004
1010 rootPart.TrimPermissions(); 1005 rootPart.TrimPermissions();
1011 1006
1012 if (isAttachment) 1007 if (isAttachment)