From 7aa54593e0b6672979feec97b8151ed134388723 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Aug 2009 20:39:48 -0700 Subject: Redirected all calls to CachedUserProfile methods to the inventory service. Redirection of the RootFolder property is still todo. This compiles but probably inventory will be inconsistent. --- .../AssetTransaction/AgentAssetsTransactions.cs | 47 ++++++++------------ .../Agent/AssetTransaction/AssetXferUploader.cs | 51 ++++++++++------------ 2 files changed, 40 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/CoreModules/Agent') diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 8d586c4..c9ee54f 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -192,40 +192,29 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { if (XferUploaders.ContainsKey(transactionID)) { - CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); - if (userInfo != null) - { - UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); - - AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString()); - - if (asset == null) - { - asset = GetTransactionAsset(transactionID); - } - - if (asset != null && asset.FullID == assetID) - { - // Assets never get updated, new ones get created - asset.FullID = UUID.Random(); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.AssetType; - item.AssetID = asset.FullID; - - Manager.MyScene.AssetService.Store(asset); - } + AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString()); - userInfo.UpdateItem(item); + if (asset == null) + { + asset = GetTransactionAsset(transactionID); } - else + + if (asset != null && asset.FullID == assetID) { - m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update", - remoteClient.AgentId); + // Assets never get updated, new ones get created + asset.FullID = UUID.Random(); + asset.Name = item.Name; + asset.Description = item.Description; + asset.Type = (sbyte)item.AssetType; + item.AssetID = asset.FullID; + + Manager.MyScene.AssetService.Store(asset); } + + IInventoryService invService = Manager.MyScene.InventoryService; + invService.UpdateItem(item); } } } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index afd9f5a..e192b81 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -32,6 +32,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { @@ -214,39 +215,31 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction private void DoCreateItem(uint callbackID) { m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); - CachedUserInfo userInfo = - m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( - ourClient.AgentId); - if (userInfo != null) - { - InventoryItemBase item = new InventoryItemBase(); - item.Owner = ourClient.AgentId; - item.CreatorId = ourClient.AgentId.ToString(); - item.ID = UUID.Random(); - item.AssetID = m_asset.FullID; - item.Description = m_description; - item.Name = m_name; - item.AssetType = type; - item.InvType = invType; - item.Folder = InventFolder; - item.BasePermissions = 0x7fffffff; - item.CurrentPermissions = 0x7fffffff; - item.GroupPermissions=0; - item.EveryOnePermissions=0; - item.NextPermissions = nextPerm; - item.Flags = (uint) wearableType; - item.CreationDate = Util.UnixTimeSinceEpoch(); + IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService; + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = ourClient.AgentId; + item.CreatorId = ourClient.AgentId.ToString(); + item.ID = UUID.Random(); + item.AssetID = m_asset.FullID; + item.Description = m_description; + item.Name = m_name; + item.AssetType = type; + item.InvType = invType; + item.Folder = InventFolder; + item.BasePermissions = 0x7fffffff; + item.CurrentPermissions = 0x7fffffff; + item.GroupPermissions=0; + item.EveryOnePermissions=0; + item.NextPermissions = nextPerm; + item.Flags = (uint) wearableType; + item.CreationDate = Util.UnixTimeSinceEpoch(); - userInfo.AddItem(item); + if (invService.AddItem(item)) ourClient.SendInventoryItemCreateUpdate(item, callbackID); - } else - { - m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", - ourClient.AgentId); - } + ourClient.SendAlertMessage("Unable to create inventory item"); } /// -- cgit v1.1 From 6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Aug 2009 11:30:29 -0700 Subject: Inventory redirects from CachedUserInfo to InventoryService COMPLETE! --- .../Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Agent') diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index fa5369f..956dd10 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs @@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using BlockingQueue = OpenSim.Framework.BlockingQueue; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Agent.TextureDownload { @@ -217,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload if (profile == null) // Deny unknown user return; - if (profile.RootFolder == null) // Deny no inventory + IInventoryService invService = scene.InventoryService; + 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 -- cgit v1.1 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. --- .../CoreModules/Agent/TextureDownload/TextureDownloadModule.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Agent') 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"); } -- cgit v1.1