diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d30ce72..b4771fd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
203 | m_Scene.AssetService.Store(asset); | 203 | m_Scene.AssetService.Store(asset); |
204 | m_Scene.CreateNewInventoryItem( | 204 | m_Scene.CreateNewInventoryItem( |
205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
206 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | 206 | name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
@@ -292,7 +292,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
292 | 292 | ||
293 | return UUID.Zero; | 293 | return UUID.Zero; |
294 | } | 294 | } |
295 | 295 | ||
296 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | ||
297 | { | ||
298 | if (item != null && item.Owner == ownerID && asset != null) | ||
299 | { | ||
300 | item.AssetID = asset.FullID; | ||
301 | item.Description = asset.Description; | ||
302 | item.Name = asset.Name; | ||
303 | item.AssetType = asset.Type; | ||
304 | item.InvType = (int)InventoryType.Object; | ||
305 | |||
306 | m_Scene.AssetService.Store(asset); | ||
307 | m_Scene.InventoryService.UpdateItem(item); | ||
308 | |||
309 | return true; | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}", | ||
314 | (item == null || asset == null? "null item or asset" : "wrong owner")); | ||
315 | return false; | ||
316 | } | ||
317 | |||
318 | } | ||
319 | |||
296 | public virtual List<InventoryItemBase> CopyToInventory( | 320 | public virtual List<InventoryItemBase> CopyToInventory( |
297 | DeRezAction action, UUID folderID, | 321 | DeRezAction action, UUID folderID, |
298 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) | 322 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) |
@@ -532,6 +556,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
532 | 556 | ||
533 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 557 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
534 | { | 558 | { |
559 | // Changing ownership, so apply the "Next Owner" permissions to all of the | ||
560 | // inventory item's permissions. | ||
561 | |||
535 | uint perms = effectivePerms; | 562 | uint perms = effectivePerms; |
536 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); | 563 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
537 | 564 | ||
@@ -546,6 +573,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
546 | } | 573 | } |
547 | else | 574 | else |
548 | { | 575 | { |
576 | // Not changing ownership. | ||
577 | // In this case we apply the permissions in the object's items ONLY to the inventory | ||
578 | // item's "Next Owner" permissions, but NOT to its "Current", "Base", etc. permissions. | ||
579 | // E.g., if the object contains a No-Transfer item then the item's "Next Owner" | ||
580 | // permissions are also No-Transfer. | ||
581 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref allObjectsNextOwnerPerms); | ||
582 | |||
549 | item.BasePermissions = effectivePerms; | 583 | item.BasePermissions = effectivePerms; |
550 | item.CurrentPermissions = effectivePerms; | 584 | item.CurrentPermissions = effectivePerms; |
551 | item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; | 585 | item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; |
@@ -773,12 +807,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
773 | m_log.WarnFormat( | 807 | m_log.WarnFormat( |
774 | "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", | 808 | "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", |
775 | assetID, item.Name, item.ID, remoteClient.Name); | 809 | assetID, item.Name, item.ID, remoteClient.Name); |
810 | remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0} for item {1}.", assetID, item.Name), false); | ||
776 | } | 811 | } |
777 | else | 812 | else |
778 | { | 813 | { |
779 | m_log.WarnFormat( | 814 | m_log.WarnFormat( |
780 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", | 815 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", |
781 | assetID, remoteClient.Name); | 816 | assetID, remoteClient.Name); |
817 | remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0}.", assetID), false); | ||
782 | } | 818 | } |
783 | 819 | ||
784 | return null; | 820 | return null; |