aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs52
3 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index c1e92f5..b13b9d8 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); 158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
160 if (ids.ContainsKey(assetID))
161 ids.Remove(assetID);
160 foreach (UUID uuid in ids.Keys) 162 foreach (UUID uuid in ids.Keys)
161 FetchAsset(userAssetURL, uuid); 163 FetchAsset(userAssetURL, uuid);
162 164
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index b0555da..6fdd2a8 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -192,6 +192,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
192 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 192 m_assMapper.Post(item.AssetID, receiver, userAssetServer);
193 } 193 }
194 194
195
196
195 #endregion 197 #endregion
196 198
197 public bool IsForeignUser(UUID userID, out string assetServerURL) 199 public bool IsForeignUser(UUID userID, out string assetServerURL)
@@ -217,5 +219,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
217 219
218 return false; 220 return false;
219 } 221 }
222
223 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
224 {
225 InventoryItemBase item = base.GetItem(agentID, itemID);
226
227 string userAssetServer = string.Empty;
228 if (IsForeignUser(agentID, out userAssetServer))
229 m_assMapper.Get(item.AssetID, agentID, userAssetServer);
230
231 return item;
232 }
220 } 233 }
221} 234}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 12b6aa0..39616f7 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -639,6 +639,50 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
639 { 639 {
640 } 640 }
641 641
642 public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
643 {
644 InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
645 if (assetRequestItem == null)
646 {
647 ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
648 if (lib != null)
649 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
650 if (assetRequestItem == null)
651 return false;
652 }
653
654 // At this point, we need to apply perms
655 // only to notecards and scripts. All
656 // other asset types are always available
657 //
658 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
659 {
660 if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
661 {
662 remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
663 return false;
664 }
665 }
666 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
667 {
668 if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
669 {
670 remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
671 return false;
672 }
673 }
674
675 if (assetRequestItem.AssetID != requestID)
676 {
677 m_log.WarnFormat(
678 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
679 Name, requestID, itemID, assetRequestItem.AssetID);
680 return false;
681 }
682
683 return true;
684 }
685
642 #endregion 686 #endregion
643 687
644 #region Misc 688 #region Misc
@@ -661,6 +705,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
661 return asset; 705 return asset;
662 } 706 }
663 707
708 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
709 {
710 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
711 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
712 assetRequestItem = invService.GetItem(assetRequestItem);
713 return assetRequestItem;
714 }
715
664 #endregion 716 #endregion
665 } 717 }
666} 718}