From 034c9cf606373bfa9d3f8040cd787f789e0efbf2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Aug 2009 17:34:15 -0700 Subject: Added GetAssetPermissions. Few last bugs nixed. This is ready for testing. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 15 +++++++-------- .../Agent/TextureDownload/TextureDownloadModule.cs | 8 ++++++-- .../Inventory/BaseInventoryConnector.cs | 7 ++++++- .../Inventory/HGInventoryBroker.cs | 17 +++++++++++++---- .../Inventory/LocalInventoryServiceConnector.cs | 20 +++++++++++--------- .../Inventory/RemoteInventoryServiceConnector.cs | 10 ++++++---- 6 files changed, 49 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a3e275d..6dda5aa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2156,16 +2156,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase) { - // XXX: Nasty temporary move that will be resolved shortly - InventoryFolderImpl folder = (InventoryFolderImpl)folderBase; - // We will use the same transaction id for all the separate packets to be sent out in this update. UUID transactionId = UUID.Random(); List folderDataBlocks = new List(); - SendBulkUpdateInventoryFolderRecursive(folder, ref folderDataBlocks, transactionId); + SendBulkUpdateInventoryFolderRecursive(folderBase, ref folderDataBlocks, transactionId); if (folderDataBlocks.Count > 0) { @@ -2191,17 +2188,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// private void SendBulkUpdateInventoryFolderRecursive( - InventoryFolderImpl folder, ref List folderDataBlocks, + InventoryFolderBase folder, ref List folderDataBlocks, UUID transactionId) { folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); const int MAX_ITEMS_PER_PACKET = 5; + IInventoryService invService = m_scene.RequestModuleInterface(); // If there are any items then we have to start sending them off in this packet - the next folder will have // to be in its own bulk update packet. Also, we can only fit 5 items in a packet (at least this was the limit // being used on the Linden grid at 20081203). - List items = folder.RequestListOfItems(); + InventoryCollection contents = invService.GetFolderContent(AgentId, folder.ID); // folder.RequestListOfItems(); + List items = contents.Items; while (items.Count > 0) { BulkUpdateInventoryPacket bulkUpdate @@ -2233,8 +2232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); } - List subFolders = folder.RequestListOfFolderImpls(); - foreach (InventoryFolderImpl subFolder in subFolders) + List subFolders = contents.Folders; + foreach (InventoryFolderBase subFolder in subFolders) { SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId); } diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index 956dd10..71ff28c 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs @@ -222,8 +222,12 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory return; - if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned - return; + // Diva 2009-08-13: this test doesn't make any sense to many devs + //if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned + //{ + // m_log.WarnFormat("[TEXTURE]: user {0} doesn't have permissions to texture {1}"); + // return; + //} m_log.Debug("Texture preview"); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index 0526bc4..ef5ffe1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// null if no root folder was found - public abstract InventoryFolderBase GetRootFolder(UUID userID); + public InventoryFolderBase GetRootFolder(UUID userID) + { + // Root folder is here as system type Folder. + return m_cache.GetFolderForType(userID, AssetType.Folder); + } public abstract Dictionary GetSystemFolders(UUID userID); @@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// public abstract List GetActiveGestures(UUID userId); + public abstract int GetAssetPermissions(UUID userID, UUID assetID); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index db4e7f4..fd12a57 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -263,6 +263,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory folders[(AssetType)folder.Type] = folder; } m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); + // Put the root folder there, as type Folder + folders[AssetType.Folder] = root; return folders; } m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); @@ -422,14 +424,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return false; } - public override InventoryFolderBase GetRootFolder(UUID userID) + public override List GetActiveGestures(UUID userId) { - return null; + return new List(); } - public override List GetActiveGestures(UUID userId) + public override int GetAssetPermissions(UUID userID, UUID assetID) { - return new List(); + if (IsLocalGridUser(userID)) + return m_GridService.GetAssetPermissions(userID, assetID); + else + { + UUID sessionID = GetSessionID(userID); + string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); + return m_HGService.GetAssetPermissions(uri, assetID, sessionID); + } } #endregion diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index ccf06d1..2fbc5fe 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory foreach (InventoryFolderBase folder in content.Folders) { if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) + { + m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type); folders[(AssetType)folder.Type] = folder; + } } + // Put the root folder there, as type Folder + folders[AssetType.Folder] = root; + m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type); + return folders; } } @@ -312,19 +319,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.HasInventoryForUser(userID); } - /// - /// Retrieve the root inventory folder for the given user. - /// - /// - /// null if no root folder was found - public override InventoryFolderBase GetRootFolder(UUID userID) + public override List GetActiveGestures(UUID userId) { - return m_InventoryService.GetRootFolder(userID); + return m_InventoryService.GetActiveGestures(userId); } - public override List GetActiveGestures(UUID userId) + public override int GetAssetPermissions(UUID userID, UUID assetID) { - return m_InventoryService.GetActiveGestures(userId); + return m_InventoryService.GetAssetPermissions(userID, assetID); } #endregion IInventoryService } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 4f19573..e4bb865 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -296,16 +296,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return false; } - public override InventoryFolderBase GetRootFolder(UUID userID) + public override List GetActiveGestures(UUID userId) { - return null; + return new List(); } - public override List GetActiveGestures(UUID userId) + public override int GetAssetPermissions(UUID userID, UUID assetID) { - return new List(); + UUID sessionID = GetSessionID(userID); + return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID); } + #endregion private UUID GetSessionID(UUID userID) -- cgit v1.1