aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-07-04 13:56:03 -0700
committerDiva Canto2010-07-04 13:56:03 -0700
commit02a15bc787b2cc6784c9626e041a4365ec362194 (patch)
treeae50c7d544052b51fc50f364832492b6d9160165 /OpenSim
parentFixes the obvious problem in mantis #4841. Melanie needs to look at other pot... (diff)
downloadopensim-SC_OLD-02a15bc787b2cc6784c9626e041a4365ec362194.zip
opensim-SC_OLD-02a15bc787b2cc6784c9626e041a4365ec362194.tar.gz
opensim-SC_OLD-02a15bc787b2cc6784c9626e041a4365ec362194.tar.bz2
opensim-SC_OLD-02a15bc787b2cc6784c9626e041a4365ec362194.tar.xz
Started to clean up the mess with HyperAssets in LLClientView. Fixed HG access to Notecards in user's inventory.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs1
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs89
-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
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs2
6 files changed, 78 insertions, 81 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 9869a99..f6ad6e1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -379,6 +379,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
379 { 379 {
380 // Try the user's inventory, but only if it's different from the regions' 380 // Try the user's inventory, but only if it's different from the regions'
381 string userAssets = HyperAssets.GetUserAssetServer(AgentID); 381 string userAssets = HyperAssets.GetUserAssetServer(AgentID);
382
382 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) 383 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
383 { 384 {
384 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); 385 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index d2824bd..3a2c019 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -7196,59 +7196,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7196 } 7196 }
7197 else // Agent 7197 else // Agent
7198 { 7198 {
7199 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); 7199 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
7200 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); 7200 if (invAccess != null)
7201 assetRequestItem = invService.GetItem(assetRequestItem);
7202 if (assetRequestItem == null)
7203 { 7201 {
7204 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>(); 7202 if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
7205 if (lib != null) 7203 return false;
7206 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
7207 if (assetRequestItem == null)
7208 return true;
7209 }
7210 7204
7211 // At this point, we need to apply perms
7212 // only to notecards and scripts. All
7213 // other asset types are always available
7214 //
7215 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
7216 {
7217 if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
7218 {
7219 SendAgentAlertMessage("Insufficient permissions to view script", false);
7220 return true;
7221 }
7222 }
7223 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
7224 {
7225 if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
7226 {
7227 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
7228 return true;
7229 }
7230 } 7205 }
7206 else
7207 return false;
7231 7208
7232 if (assetRequestItem.AssetID != requestID)
7233 {
7234 m_log.WarnFormat(
7235 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
7236 Name, requestID, itemID, assetRequestItem.AssetID);
7237 return true;
7238 }
7239 } 7209 }
7240 } 7210 }
7241 } 7211 }
7242 7212
7243 //m_assetCache.AddAssetRequest(this, transfer);
7244
7245 MakeAssetRequest(transfer, taskID); 7213 MakeAssetRequest(transfer, taskID);
7246 7214
7247 /* RequestAsset = OnRequestAsset;
7248 if (RequestAsset != null)
7249 {
7250 RequestAsset(this, transfer);
7251 }*/
7252 return true; 7215 return true;
7253 } 7216 }
7254 7217
@@ -11459,15 +11422,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11459 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11422 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11460 { 11423 {
11461 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11424 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11462 //m_log.Debug("[XXX] inventory asset request " + requestID);
11463 //if (taskID == UUID.Zero) // Agent
11464 // if (m_scene is HGScene)
11465 // {
11466 // m_log.Debug("[XXX] hg asset request " + requestID);
11467 // // We may need to fetch the asset from the user's asset server into the local asset server
11468 // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
11469 // mapper.Get(requestID, AgentId);
11470 // }
11471 } 11425 }
11472 11426
11473// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 11427// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
@@ -11488,44 +11442,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11488 UUID requestID = UUID.Zero; 11442 UUID requestID = UUID.Zero;
11489 byte source = (byte)SourceType.Asset; 11443 byte source = (byte)SourceType.Asset;
11490 11444
11491 if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 11445 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11492 || (transferRequest.TransferInfo.SourceType == 2222))
11493 { 11446 {
11494 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11447 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11495 } 11448 }
11496 else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11449 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11497 || (transferRequest.TransferInfo.SourceType == 3333))
11498 { 11450 {
11499 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11451 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11500 source = (byte)SourceType.SimInventoryItem; 11452 source = (byte)SourceType.SimInventoryItem;
11501 //m_log.Debug("asset request " + requestID); 11453 //m_log.Debug("asset request " + requestID);
11502 } 11454 }
11503 11455
11504 if (null == asset)
11505 {
11506 if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
11507 {
11508 // Try the user's inventory, but only if it's different from the regions'
11509 string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
11510 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
11511 {
11512 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
11513 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11514 transferRequest.TransferInfo.SourceType = 2222; // marker
11515 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11516 transferRequest.TransferInfo.SourceType = 3333; // marker
11517
11518 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
11519 return;
11520 }
11521 }
11522
11523 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
11524
11525 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
11526 return;
11527 }
11528
11529 // Scripts cannot be retrieved by direct request 11456 // Scripts cannot be retrieved by direct request
11530 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) 11457 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
11531 return; 11458 return;
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}
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 97f4188..2d4f509 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -43,5 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces
43 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 43 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
44 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); 44 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
45 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); 45 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver);
46 bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
47 //bool GetTextureFromAgentInventory(UUID agentID, UUID assetID);
46 } 48 }
47} 49}