aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs276
1 files changed, 197 insertions, 79 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 5a9efb8..96f1198 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -178,49 +178,55 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
178 sbyte assetType, 178 sbyte assetType,
179 byte wearableType, uint nextOwnerMask, int creationDate) 179 byte wearableType, uint nextOwnerMask, int creationDate)
180 { 180 {
181 m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}", name, folderID); 181 m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}, transactionID {2}", name,
182 folderID, transactionID);
182 183
183 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) 184 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
184 return; 185 return;
185 186
186 if (transactionID == UUID.Zero) 187 InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId);
188 InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f);
189
190 if (folder == null || folder.Owner != remoteClient.AgentId)
191 return;
192
193 if (transactionID != UUID.Zero)
187 { 194 {
188 ScenePresence presence; 195 IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule;
189 if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 196 if (agentTransactions != null)
190 { 197 {
191 byte[] data = null; 198 if (agentTransactions.HandleItemCreationFromTransaction(
199 remoteClient, transactionID, folderID, callbackID, description,
200 name, invType, assetType, wearableType, nextOwnerMask))
201 return;
202 }
203 }
192 204
193 if (invType == (sbyte)InventoryType.Landmark && presence != null) 205 ScenePresence presence;
194 { 206 if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
195 string suffix = string.Empty, prefix = string.Empty; 207 {
196 string strdata = GenerateLandmark(presence, out prefix, out suffix); 208 byte[] data = null;
197 data = Encoding.ASCII.GetBytes(strdata);
198 name = prefix + name;
199 description += suffix;
200 }
201 209
202 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); 210 if (invType == (sbyte)InventoryType.Landmark && presence != null)
203 m_Scene.AssetService.Store(asset);
204 m_Scene.CreateNewInventoryItem(
205 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
206 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
207 }
208 else
209 { 211 {
210 m_log.ErrorFormat( 212 string suffix = string.Empty, prefix = string.Empty;
211 "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", 213 string strdata = GenerateLandmark(presence, out prefix, out suffix);
212 remoteClient.AgentId); 214 data = Encoding.ASCII.GetBytes(strdata);
215 name = prefix + name;
216 description += suffix;
213 } 217 }
218
219 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
220 m_Scene.AssetService.Store(asset);
221 m_Scene.CreateNewInventoryItem(
222 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
223 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
214 } 224 }
215 else 225 else
216 { 226 {
217 IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule; 227 m_log.ErrorFormat(
218 if (agentTransactions != null) 228 "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem",
219 { 229 remoteClient.AgentId);
220 agentTransactions.HandleItemCreationFromTransaction(
221 remoteClient, transactionID, folderID, callbackID, description,
222 name, invType, assetType, wearableType, nextOwnerMask);
223 }
224 } 230 }
225 } 231 }
226 232
@@ -272,6 +278,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
272 278
273 remoteClient.SendAlertMessage("Script saved"); 279 remoteClient.SendAlertMessage("Script saved");
274 } 280 }
281 else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet)
282 {
283 AnimationSet animSet = new AnimationSet(data);
284 if (!animSet.Validate(x => {
285 int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x);
286 int required = (int)(PermissionMask.Transfer | PermissionMask.Copy);
287 if ((perms & required) != required)
288 return false;
289 return true;
290 }))
291 {
292 data = animSet.ToBytes();
293 }
294 }
275 295
276 AssetBase asset = 296 AssetBase asset =
277 CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); 297 CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
@@ -380,7 +400,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
380 bool asAttachment) 400 bool asAttachment)
381 { 401 {
382 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); 402 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
383// Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); 403 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
404 // this possible is not needed if keyframes are saved
405 Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
384 406
385 Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>(); 407 Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>();
386 408
@@ -388,24 +410,46 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
388 { 410 {
389 if (objectGroup.RootPart.KeyframeMotion != null) 411 if (objectGroup.RootPart.KeyframeMotion != null)
390 { 412 {
391 objectGroup.RootPart.KeyframeMotion.Pause(); 413 objectGroup.RootPart.KeyframeMotion.Suspend();
392 group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion); 414 }
393 objectGroup.RootPart.KeyframeMotion = null; 415 objectGroup.RootPart.SetForce(Vector3.Zero);
416 objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
417
418 originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion;
419 objectGroup.RootPart.KeyframeMotion = null;
420
421 Vector3 inventoryStoredPosition = new Vector3
422 (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
423 ? 250
424 : objectGroup.AbsolutePosition.X)
425 ,
426 (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
427 ? 250
428 : objectGroup.AbsolutePosition.Y,
429 objectGroup.AbsolutePosition.Z);
430
431 Quaternion inventoryStoredRotation = objectGroup.GroupRotation;
432 originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
433
434 // Restore attachment data after trip through the sim
435 if (objectGroup.RootPart.AttachPoint > 0)
436 {
437 inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
438 inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
394 } 439 }
395 440
396// Vector3 inventoryStoredPosition = new Vector3 441 // Trees could be attached and it's been done, but it makes
397// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) 442 // no sense. State must be preserved because it's the tree type
398// ? 250 443 if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
399// : objectGroup.AbsolutePosition.X) 444 objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
400// , 445 {
401// (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) 446 objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
402// ? 250 447 if (objectGroup.RootPart.AttachPoint > 0)
403// : objectGroup.AbsolutePosition.Y, 448 objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
404// objectGroup.AbsolutePosition.Z); 449 }
405// 450
406// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; 451 objectGroup.AbsolutePosition = inventoryStoredPosition;
407// 452 objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
408// objectGroup.AbsolutePosition = inventoryStoredPosition;
409 453
410 // Make sure all bits but the ones we want are clear 454 // Make sure all bits but the ones we want are clear
411 // on take. 455 // on take.
@@ -433,9 +477,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
433 else 477 else
434 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment); 478 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment);
435 479
436// // Restore the position of each group now that it has been stored to inventory. 480 // Restore the position of each group now that it has been stored to inventory.
437// foreach (SceneObjectGroup objectGroup in objlist) 481 foreach (SceneObjectGroup objectGroup in objlist)
438// objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; 482 {
483 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
484 objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID];
485 if (objectGroup.RootPart.KeyframeMotion != null)
486 objectGroup.RootPart.KeyframeMotion.Resume();
487 }
439 488
440 InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); 489 InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
441 490
@@ -492,7 +541,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
492 item.Name = asset.Name; 541 item.Name = asset.Name;
493 item.AssetType = asset.Type; 542 item.AssetType = asset.Type;
494 543
495 AddPermissions(item, objlist[0], objlist, remoteClient); 544 //preserve perms on return
545 if(DeRezAction.Return == action)
546 AddPermissions(item, objlist[0], objlist, null);
547 else
548 AddPermissions(item, objlist[0], objlist, remoteClient);
496 549
497 m_Scene.AddInventoryItem(item); 550 m_Scene.AddInventoryItem(item);
498 551
@@ -543,15 +596,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
543 { 596 {
544 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 597 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
545 uint allObjectsNextOwnerPerms = 0x7fffffff; 598 uint allObjectsNextOwnerPerms = 0x7fffffff;
546 uint allObjectsEveryOnePerms = 0x7fffffff;
547 uint allObjectsGroupPerms = 0x7fffffff;
548 599
600 // For the porposes of inventory, an object is modify if the prims
601 // are modify. This allows renaming an object that contains no
602 // mod items.
549 foreach (SceneObjectGroup grp in objsForEffectivePermissions) 603 foreach (SceneObjectGroup grp in objsForEffectivePermissions)
550 { 604 {
551 effectivePerms &= grp.GetEffectivePermissions(); 605 uint groupPerms = grp.GetEffectivePermissions(true);
552 allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask; 606 if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
553 allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask; 607 groupPerms |= (uint)PermissionMask.Modify;
554 allObjectsGroupPerms &= grp.RootPart.GroupMask; 608
609 effectivePerms &= groupPerms;
555 } 610 }
556 effectivePerms |= (uint)PermissionMask.Move; 611 effectivePerms |= (uint)PermissionMask.Move;
557 612
@@ -565,11 +620,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565 uint perms = effectivePerms; 620 uint perms = effectivePerms;
566 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); 621 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
567 622
568 item.BasePermissions = perms & allObjectsNextOwnerPerms; 623 item.BasePermissions = perms & so.RootPart.NextOwnerMask;
569 item.CurrentPermissions = item.BasePermissions; 624 item.CurrentPermissions = item.BasePermissions;
570 item.NextPermissions = perms & allObjectsNextOwnerPerms; 625 item.NextPermissions = perms & so.RootPart.NextOwnerMask;
571 item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms; 626 item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
572 item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms; 627 item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
573 628
574 // apply next owner perms on rez 629 // apply next owner perms on rez
575 item.CurrentPermissions |= SceneObjectGroup.SLAM; 630 item.CurrentPermissions |= SceneObjectGroup.SLAM;
@@ -585,9 +640,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
585 640
586 item.BasePermissions = effectivePerms; 641 item.BasePermissions = effectivePerms;
587 item.CurrentPermissions = effectivePerms; 642 item.CurrentPermissions = effectivePerms;
588 item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; 643 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms;
589 item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms; 644 item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms;
590 item.GroupPermissions = allObjectsGroupPerms & effectivePerms; 645 item.GroupPermissions = so.RootPart.GroupMask & effectivePerms;
591 646
592 item.CurrentPermissions &= 647 item.CurrentPermissions &=
593 ((uint)PermissionMask.Copy | 648 ((uint)PermissionMask.Copy |
@@ -743,7 +798,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
743 if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId) 798 if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId)
744 { 799 {
745 InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); 800 InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
746 folder = m_Scene.InventoryService.GetFolder(f); 801 if (f != null)
802 folder = m_Scene.InventoryService.GetFolder(f);
747 803
748 if(folder.Type == 14 || folder.Type == 16) 804 if(folder.Type == 14 || folder.Type == 16)
749 { 805 {
@@ -779,16 +835,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
779 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 835 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
780 { 836 {
781// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); 837// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
782
783 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 838 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
784 item = m_Scene.InventoryService.GetItem(item); 839 item = m_Scene.InventoryService.GetItem(item);
785 840
786 if (item == null) 841 if (item == null)
787 { 842 {
788 m_log.WarnFormat(
789 "[INVENTORY ACCESS MODULE]: Could not find item {0} for {1} in RezObject()",
790 itemID, remoteClient.Name);
791
792 return null; 843 return null;
793 } 844 }
794 845
@@ -856,12 +907,35 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
856 pos -= bbox / 2; 907 pos -= bbox / 2;
857 } 908 }
858 909
910 int primcount = 0;
911 foreach (SceneObjectGroup g in objlist)
912 primcount += g.PrimCount;
913
914 if (!m_Scene.Permissions.CanRezObject(
915 primcount, remoteClient.AgentId, pos)
916 && !attachment)
917 {
918 // The client operates in no fail mode. It will
919 // have already removed the item from the folder
920 // if it's no copy.
921 // Put it back if it's not an attachment
922 //
923 if (item != null)
924 {
925 if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
926 remoteClient.SendBulkUpdateInventory(item);
927 }
928
929 return null;
930 }
931
859 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment)) 932 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment))
860 return null; 933 return null;
861 934
862 for (int i = 0; i < objlist.Count; i++) 935 for (int i = 0; i < objlist.Count; i++)
863 { 936 {
864 group = objlist[i]; 937 group = objlist[i];
938 SceneObjectPart rootPart = group.RootPart;
865 939
866// m_log.DebugFormat( 940// m_log.DebugFormat(
867// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", 941// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
@@ -909,7 +983,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
909 983
910 if (attachment) 984 if (attachment)
911 { 985 {
912 group.RootPart.Flags |= PrimFlags.Phantom; 986// group.RootPart.Flags |= PrimFlags.Phantom;
913 group.IsAttachment = true; 987 group.IsAttachment = true;
914 } 988 }
915 989
@@ -934,8 +1008,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
934 1008
935 if (!attachment) 1009 if (!attachment)
936 { 1010 {
937 SceneObjectPart rootPart = group.RootPart;
938
939 if (rootPart.Shape.PCode == (byte)PCode.Prim) 1011 if (rootPart.Shape.PCode == (byte)PCode.Prim)
940 group.ClearPartAttachmentData(); 1012 group.ClearPartAttachmentData();
941 1013
@@ -953,6 +1025,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
953// remoteClient.Name); 1025// remoteClient.Name);
954 } 1026 }
955 1027
1028 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
1029
956 if (item != null) 1030 if (item != null)
957 DoPostRezWhenFromItem(item, attachment); 1031 DoPostRezWhenFromItem(item, attachment);
958 1032
@@ -1033,10 +1107,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1033 // object itself before we rez. 1107 // object itself before we rez.
1034 // 1108 //
1035 // Only do these for the first object if we are rezzing a coalescence. 1109 // Only do these for the first object if we are rezzing a coalescence.
1036 if (i == 0) 1110 // nahh dont mess with coalescence objects,
1111 // the name in inventory can be change for inventory purpuses only
1112 if (objlist.Count == 1)
1037 { 1113 {
1038 rootPart.Name = item.Name; 1114 rootPart.Name = item.Name;
1039 rootPart.Description = item.Description; 1115 rootPart.Description = item.Description;
1116 }
1117
1118 if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
1119 {
1040 rootPart.ObjectSaleType = item.SaleType; 1120 rootPart.ObjectSaleType = item.SaleType;
1041 rootPart.SalePrice = item.SalePrice; 1121 rootPart.SalePrice = item.SalePrice;
1042 } 1122 }
@@ -1047,17 +1127,55 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1047// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", 1127// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
1048// rootPart.OwnerID, item.Owner, item.CurrentPermissions); 1128// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
1049 1129
1050 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) 1130 if ((rootPart.OwnerID != item.Owner) ||
1131 (item.CurrentPermissions & 16) != 0 ||
1132 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
1051 { 1133 {
1052 //Need to kill the for sale here 1134 //Need to kill the for sale here
1053 rootPart.ObjectSaleType = 0; 1135 rootPart.ObjectSaleType = 0;
1054 rootPart.SalePrice = 10; 1136 rootPart.SalePrice = 10;
1055 } 1137
1138 if (m_Scene.Permissions.PropagatePermissions())
1139 {
1140 foreach (SceneObjectPart part in so.Parts)
1141 {
1142 part.GroupMask = 0; // DO NOT propagate here
1143
1144 part.LastOwnerID = part.OwnerID;
1145 part.OwnerID = item.Owner;
1146 part.Inventory.ChangeInventoryOwner(item.Owner);
1147 }
1148
1149 so.ApplyNextOwnerPermissions();
1056 1150
1057 foreach (SceneObjectPart part in so.Parts) 1151 // In case the user has changed flags on a received item
1152 // we have to apply those changes after the slam. Else we
1153 // get a net loss of permissions
1154 foreach (SceneObjectPart part in so.Parts)
1155 {
1156 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
1157 {
1158 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
1159 part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
1160 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
1161 part.NextOwnerMask = item.NextPermissions & part.BaseMask;
1162 }
1163 }
1164 }
1165 }
1166 else
1058 { 1167 {
1059 part.FromUserInventoryItemID = fromUserInventoryItemId; 1168 foreach (SceneObjectPart part in so.Parts)
1060 part.ApplyPermissionsOnRez(item, true, m_Scene); 1169 {
1170 part.FromUserInventoryItemID = fromUserInventoryItemId;
1171
1172 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
1173 part.EveryoneMask = item.EveryOnePermissions;
1174 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
1175 part.NextOwnerMask = item.NextPermissions;
1176 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
1177 part.GroupMask = item.GroupPermissions;
1178 }
1061 } 1179 }
1062 1180
1063 rootPart.TrimPermissions(); 1181 rootPart.TrimPermissions();