diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
5 files changed, 85 insertions, 13 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..8ccc941 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
131 | return ret; | 131 | return ret; |
132 | } | 132 | } |
133 | 133 | ||
134 | // DO NOT OVERRIDE THIS METHOD | 134 | // DO NOT OVERRIDE THE BASE METHOD |
135 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | 135 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, |
136 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | 136 | SceneObjectGroup objectGroup, IClientAPI remoteClient) |
137 | { | 137 | { |
@@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
139 | 139 | ||
140 | if (!assetID.Equals(UUID.Zero)) | 140 | if (!assetID.Equals(UUID.Zero)) |
141 | { | 141 | { |
142 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); | 142 | if (remoteClient != null) |
143 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); | ||
143 | } | 144 | } |
144 | else | 145 | else |
145 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | 146 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); |
@@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
192 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); | 193 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); |
193 | } | 194 | } |
194 | 195 | ||
195 | #endregion | 196 | public override bool IsForeignUser(UUID userID, out string assetServerURL) |
196 | |||
197 | public bool IsForeignUser(UUID userID, out string assetServerURL) | ||
198 | { | 197 | { |
199 | assetServerURL = string.Empty; | 198 | assetServerURL = string.Empty; |
200 | UserAccount account = null; | 199 | UserAccount account = null; |
@@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
217 | 216 | ||
218 | return false; | 217 | return false; |
219 | } | 218 | } |
219 | |||
220 | #endregion | ||
221 | |||
222 | protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) | ||
223 | { | ||
224 | InventoryItemBase item = base.GetItem(agentID, itemID); | ||
225 | |||
226 | string userAssetServer = string.Empty; | ||
227 | if (IsForeignUser(agentID, out userAssetServer)) | ||
228 | m_assMapper.Get(item.AssetID, agentID, userAssetServer); | ||
229 | |||
230 | return item; | ||
231 | } | ||
220 | } | 232 | } |
221 | } | 233 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 12b6aa0..90b7b51 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -639,6 +639,57 @@ 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 | |||
686 | |||
687 | public virtual bool IsForeignUser(UUID userID, out string assetServerURL) | ||
688 | { | ||
689 | assetServerURL = string.Empty; | ||
690 | return false; | ||
691 | } | ||
692 | |||
642 | #endregion | 693 | #endregion |
643 | 694 | ||
644 | #region Misc | 695 | #region Misc |
@@ -661,6 +712,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
661 | return asset; | 712 | return asset; |
662 | } | 713 | } |
663 | 714 | ||
715 | protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) | ||
716 | { | ||
717 | IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>(); | ||
718 | InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID); | ||
719 | assetRequestItem = invService.GetItem(assetRequestItem); | ||
720 | return assetRequestItem; | ||
721 | } | ||
722 | |||
664 | #endregion | 723 | #endregion |
665 | } | 724 | } |
666 | } | 725 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index ebd6bbd..034e692 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset |
42 | { | 42 | { |
43 | public class HGAssetBroker : | 43 | public class HGAssetBroker : |
44 | ISharedRegionModule, IAssetService, IHyperAssetService | 44 | ISharedRegionModule, IAssetService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
150 | m_aScene = scene; | 150 | m_aScene = scene; |
151 | 151 | ||
152 | scene.RegisterModuleInterface<IAssetService>(this); | 152 | scene.RegisterModuleInterface<IAssetService>(this); |
153 | scene.RegisterModuleInterface<IHyperAssetService>(this); | ||
154 | } | 153 | } |
155 | 154 | ||
156 | public void RemoveRegion(Scene scene) | 155 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index e09db15..4ec5253 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | } | 204 | } |
205 | |||
206 | // else put a null; it means that the methods should forward to local grid's inventory | ||
207 | m_InventoryURLs.Add(userID, null); | ||
208 | } | 205 | } |
209 | 206 | ||
210 | private void DropInventoryServiceURL(UUID userID) | 207 | private void DropInventoryServiceURL(UUID userID) |
@@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
223 | if (m_InventoryURLs.ContainsKey(userID)) | 220 | if (m_InventoryURLs.ContainsKey(userID)) |
224 | return m_InventoryURLs[userID]; | 221 | return m_InventoryURLs[userID]; |
225 | 222 | ||
226 | else | 223 | CacheInventoryServiceURL(userID); |
227 | CacheInventoryServiceURL(userID); | 224 | |
225 | if (m_InventoryURLs.ContainsKey(userID)) | ||
226 | return m_InventoryURLs[userID]; | ||
228 | 227 | ||
229 | return m_InventoryURLs[userID]; | 228 | return null; //it means that the methods should forward to local grid's inventory |
229 | |||
230 | } | 230 | } |
231 | #endregion | 231 | #endregion |
232 | 232 | ||