From 7665aad002ef066fc31fa9497225d2668641c769 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Mon, 22 Feb 2010 13:27:17 -0800 Subject: [PATCH] * Adds CreatorID to asset metadata. This is just the plumbing to support CreatorID, it doesn't modify database backends or OAR files to support storing/loading it --- .../RemoteController/RemoteAdminPlugin.cs | 2 +- .../Rest/Inventory/RestAssetServices.cs | 4 ++-- .../Rest/Inventory/RestInventoryServices.cs | 2 +- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 3 ++- OpenSim/Data/MySQL/MySQLAssetData.cs | 2 +- OpenSim/Data/SQLite/SQLiteAssetData.cs | 3 ++- OpenSim/Data/Tests/BasicAssetTest.cs | 6 ++--- .../Data/Tests/PropertyCompareConstraint.cs | 12 +++++----- OpenSim/Data/Tests/PropertyScrambler.cs | 4 ++-- OpenSim/Framework/AssetBase.cs | 24 +++++++------------ OpenSim/Framework/AssetLandmark.cs | 2 +- .../Filesystem/AssetLoaderFileSystem.cs | 3 ++- OpenSim/Framework/Capabilities/Caps.cs | 2 +- OpenSim/Framework/Tests/AssetBaseTest.cs | 2 +- .../ClientStack/LindenUDP/LLFileTransfer.cs | 4 +++- .../AssetTransaction/AssetXferUploader.cs | 2 +- .../Agent/TextureSender/J2KDecoderModule.cs | 2 +- .../Archiver/InventoryArchiveReadRequest.cs | 2 +- .../InventoryAccess/HGAssetMapper.cs | 2 +- .../InventoryAccess/InventoryAccessModule.cs | 9 +++---- .../DynamicTexture/DynamicTextureModule.cs | 3 ++- .../World/Archiver/ArchiveReadRequest.cs | 2 +- .../World/Archiver/AssetsDearchiver.cs | 2 +- .../World/Estate/EstateTerrainXferHandler.cs | 2 +- .../World/WorldMap/WorldMapModule.cs | 3 ++- .../Scenes/Animation/ScenePresenceAnimator.cs | 2 +- .../Framework/Scenes/Scene.Inventory.cs | 24 +++++++++---------- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- .../Scenes/Tests/UuidGathererTests.cs | 2 +- .../Scripting/Minimodule/Graphics.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Connectors/Asset/AssetServiceConnector.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 2 +- OpenSim/Tests/Common/Setup/AssetHelpers.cs | 9 +++---- 34 files changed, 74 insertions(+), 78 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 457177d2aa..babe716379 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1564,7 +1564,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController assets = doc.GetElementsByTagName("RequiredAsset"); foreach (XmlNode asset in assets) { - AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); + AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type","")), UUID.Zero); rass.Description = GetStringAttribute(asset,"desc",""); rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 66572d5f5a..54ce80ea9e 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); + asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero); asset.Description = xml.GetAttribute("desc"); asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; @@ -338,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); + asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero); asset.Description = xml.GetAttribute("desc"); asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index fb1d739f00..9ab27639fa 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -1871,7 +1871,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // Create AssetBase entity to hold the inlined asset - asset = new AssetBase(uuid, name, type); + asset = new AssetBase(uuid, name, type, UUID.Zero); asset.Description = desc; asset.Local = local; diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 1ce4abfd16..ee149cea79 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -135,7 +135,8 @@ namespace OpenSim.Data.MSSQL AssetBase asset = new AssetBase( new UUID((Guid)reader["id"]), (string)reader["name"], - Convert.ToSByte(reader["assetType"]) + Convert.ToSByte(reader["assetType"]), + UUID.Zero ); // Region Main asset.Description = (string)reader["description"]; diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 666c22f135..a1b5d944fb 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL { if (dbReader.Read()) { - asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"]); + asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], UUID.Zero); asset.Data = (byte[])dbReader["data"]; asset.Description = (string)dbReader["description"]; diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index c52f60b2c0..46f173e642 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -234,7 +234,8 @@ namespace OpenSim.Data.SQLite AssetBase asset = new AssetBase( new UUID((String)row["UUID"]), (String)row["Name"], - Convert.ToSByte(row["Type"]) + Convert.ToSByte(row["Type"]), + UUID.Zero ); asset.Description = (String) row["Description"]; diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 25aed61866..58a17c20fc 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs @@ -66,9 +66,9 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreSimpleAsset() { - AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); - AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture); - AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture); + AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero); + AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, UUID.Zero); + AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, UUID.Zero); a1.Data = asset1; a2.Data = asset1; a3.Data = asset1; diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs index 5b1f935604..8c28fad708 100644 --- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs +++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs @@ -297,8 +297,8 @@ namespace OpenSim.Data.Tests public void AssetShouldMatch() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); - AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero); + AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero); var constraint = Constraints.PropertyCompareConstraint(expected); @@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests public void AssetShouldNotMatch() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); - AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero); + AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero); var constraint = Constraints.PropertyCompareConstraint(expected); @@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests public void AssetShouldNotMatch2() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); - AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero); + AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture, UUID.Zero); var constraint = Constraints.PropertyCompareConstraint(expected); diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index c968364919..3ee22c8d77 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs @@ -165,7 +165,7 @@ namespace OpenSim.Data.Tests [Test] public void TestScramble() { - AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); + AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero); new PropertyScrambler().Scramble(actual); } @@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests public void DontScramble() { UUID uuid = UUID.Random(); - AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture); + AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture, UUID.Zero); new PropertyScrambler() .DontScramble(x => x.Metadata) .DontScramble(x => x.FullID) diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 3e64e47dbe..f21a9b5f0f 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -61,7 +61,7 @@ namespace OpenSim.Framework m_metadata.Type = (sbyte)AssetType.Unknown; } - public AssetBase(UUID assetID, string name, sbyte assetType) + public AssetBase(UUID assetID, string name, sbyte assetType, UUID creatorID) { if (assetType == (sbyte)AssetType.Unknown) { @@ -76,7 +76,7 @@ namespace OpenSim.Framework m_metadata.Type = assetType; } - public AssetBase(string assetID, string name, sbyte assetType) + public AssetBase(string assetID, string name, sbyte assetType, UUID creatorID) { if (assetType == (sbyte)AssetType.Unknown) { @@ -220,7 +220,6 @@ namespace OpenSim.Framework public class AssetMetadata { private UUID m_fullid; - // m_id added as a dirty hack to transition from FullID to ID private string m_id; private string m_name = String.Empty; private string m_description = String.Empty; @@ -230,8 +229,7 @@ namespace OpenSim.Framework private byte[] m_sha1; private bool m_local; private bool m_temporary; - //private Dictionary m_methods = new Dictionary(); - //private OSDMap m_extra_data; + private UUID m_creatorid; public UUID FullID { @@ -324,16 +322,10 @@ namespace OpenSim.Framework set { m_temporary = value; } } - //public Dictionary Methods - //{ - // get { return m_methods; } - // set { m_methods = value; } - //} - - //public OSDMap ExtraData - //{ - // get { return m_extra_data; } - // set { m_extra_data = value; } - //} + public UUID CreatorID + { + get { return m_creatorid; } + set { m_creatorid = value; } + } } } diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index 058b442d58..7806c1fc2d 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework public int Version; public AssetLandmark(AssetBase a) - : base(a.FullID, a.Name, a.Type) + : base(a.FullID, a.Name, a.Type, a.Metadata.CreatorID) { Data = a.Data; Description = a.Description; diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 6ab1b58ad6..458dfdcb60 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -41,11 +41,12 @@ namespace OpenSim.Framework.AssetLoader.Filesystem { public class AssetLoaderFileSystem : IAssetLoader { + private static readonly UUID LIBRARY_OWNER_ID = new UUID("11111111-1111-0000-0000-000100bba000"); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) { - AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type); + AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID); if (!String.IsNullOrEmpty(path)) { diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 74c6ab0dc6..323c94c2e3 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -888,7 +888,7 @@ namespace OpenSim.Framework.Capabilities } AssetBase asset; - asset = new AssetBase(assetID, assetName, assType); + asset = new AssetBase(assetID, assetName, assType, m_agentID); asset.Data = data; if (AddNewAsset != null) AddNewAsset(asset); diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs index 18a3e011d5..0f22600a92 100644 --- a/OpenSim/Framework/Tests/AssetBaseTest.cs +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs @@ -67,7 +67,7 @@ namespace OpenSim.Framework.Tests private void CheckContainsReferences(AssetType assetType, bool expected) { - AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType); + AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero); bool actual = asset.ContainsReferences; Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index adf171e465..1e03c95231 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs @@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void Initialise(UUID fileID, string fileName) { - m_asset = new AssetBase(fileID, fileName, type); + m_asset = new AssetBase(fileID, fileName, type, UUID.Zero); m_asset.Data = new byte[0]; m_asset.Description = "empty"; m_asset.Local = true; @@ -212,6 +212,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void RequestStartXfer(IClientAPI pRemoteClient) { + m_asset.Metadata.CreatorID = pRemoteClient.AgentId; + if (!String.IsNullOrEmpty(m_asset.Name)) { pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index ebe93d5b67..1320b33f00 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction bool storeLocal, bool tempFile) { ourClient = remoteClient; - m_asset = new AssetBase(assetID, "blank", type); + m_asset = new AssetBase(assetID, "blank", type, remoteClient.AgentId); m_asset.Data = data; m_asset.Description = "empty"; m_asset.Local = storeLocal; diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 7ac8bed012..a23e8ce7cd 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { string assetID = "j2kCache_" + AssetId.ToString(); - AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard); + AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID); layerDecodeAsset.Local = true; layerDecodeAsset.Temporary = true; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 65ad70313e..5756d356aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -416,7 +416,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); - AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType); + AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero); asset.Data = data; m_scene.AssetService.Store(asset); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index e303a1f356..664f38d21b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // HGAssetService dispatches it to the remote grid. // It's not pretty, but the best that can be done while // not having a global naming infrastructure - AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type); + AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); Copy(asset, asset1); try { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d242a3403d..eec852e5d6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } AssetBase asset = - CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); + CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId); item.AssetID = asset.FullID; m_Scene.AssetService.Store(asset); @@ -339,7 +339,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess objectGroup.GetPartName(objectGroup.RootPart.LocalId), objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml)); + Utils.StringToBytes(sceneObjectXml), + objectGroup.OwnerID); m_Scene.AssetService.Store(asset); assetID = asset.FullID; @@ -640,9 +641,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess /// /// /// - private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) + private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) { - AssetBase asset = new AssetBase(UUID.Random(), name, assetType); + AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID); asset.Description = description; asset.Data = (data == null) ? new byte[1] : data; diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index e3c7bbf500..367068e140 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -309,7 +309,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } // Create a new asset for user - AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture); + AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture, + scene.RegionInfo.RegionID); asset.Data = assetData; asset.Description = String.Format("URL image : {0}", Url); asset.Local = false; diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 59a1b8f026..c4b181737b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -335,7 +335,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); - AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType); + AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero); asset.Data = data; // We're relying on the asset service to do the sensible thing and not store the asset if it already diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs index 2d2c570447..8601cae691 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs @@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); - AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType); + AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.Zero); asset.Description = metadata.Description; asset.Data = data; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs index 2ff635b1ff..d10d4d6298 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) { - m_asset = new AssetBase(UUID.Zero, pClientFilename, type); + m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId); m_asset.Data = new byte[0]; m_asset.Description = "empty"; m_asset.Local = true; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 44a651f627..6ae75a87b1 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1080,7 +1080,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap AssetBase asset = new AssetBase( m_scene.RegionInfo.RegionSettings.TerrainImageID, "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(), - (sbyte)AssetType.Texture); + (sbyte)AssetType.Texture, + m_scene.RegionInfo.RegionID); asset.Data = data; asset.Description = m_scene.RegionInfo.RegionName; asset.Temporary = temporary; diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 712dcc70e8..1eef8d0ecf 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -384,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation } } - AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation); + AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID); Animasset.Data = anim.ToBytes(); Animasset.Temporary = true; Animasset.Local = true; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ded001b510..7928811c92 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes return new ArrayList(); } - AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); + AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); AssetService.Store(asset); if (isScriptRunning) @@ -570,15 +570,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Create a new asset data structure. /// - /// - /// - /// - /// - /// - /// - private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) + private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) { - AssetBase asset = new AssetBase(UUID.Random(), name, assetType); + AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID); asset.Description = description; asset.Data = (data == null) ? new byte[1] : data; @@ -704,7 +698,7 @@ namespace OpenSim.Region.Framework.Scenes data = Encoding.ASCII.GetBytes(strdata); } - AssetBase asset = CreateAsset(name, description, assetType, data); + AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId); AssetService.Store(asset); CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); @@ -1289,7 +1283,9 @@ namespace OpenSim.Region.Framework.Scenes itemBase.InvType, part.UUID, remoteClient.AgentId)) return; - AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); + AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, + Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), + remoteClient.AgentId); AssetService.Store(asset); TaskInventoryItem taskItem = new TaskInventoryItem(); @@ -1583,7 +1579,8 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.GetPartName(objectGroup.LocalId), objectGroup.GetPartDescription(objectGroup.LocalId), (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml)); + Utils.StringToBytes(sceneObjectXml), + remoteClient.AgentId); AssetService.Store(asset); item.AssetID = asset.FullID; @@ -1630,7 +1627,8 @@ namespace OpenSim.Region.Framework.Scenes grp.GetPartName(grp.LocalId), grp.GetPartDescription(grp.LocalId), (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml)); + Utils.StringToBytes(sceneObjectXml), + remoteClient.AgentId); AssetService.Store(asset); InventoryItemBase item = new InventoryItemBase(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 72ece10d5b..d5ceda8ce0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4389,7 +4389,8 @@ namespace OpenSim.Region.Framework.Scenes group.GetPartName(localID), group.GetPartDescription(localID), (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml)); + Utils.StringToBytes(sceneObjectXml), + group.OwnerID); AssetService.Store(asset); InventoryItemBase item = new InventoryItemBase(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index a36c4dbae5..6686264ec1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); - AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET"); + AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero); m_assetService.Store(corruptAsset); IDictionary foundAssetUuids = new Dictionary(); diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs index 8ea7ad39e4..4a5248bd6f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) { - AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture); + AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID); asset.Data = OpenJPEG.EncodeFromImage(data, lossless); asset.Description = "MRM Image"; asset.Local = false; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fccd07ee21..68764e1bf6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1474,7 +1474,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // Create new asset - AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard); + AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID); asset.Description = "Script Generated Notecard"; string notecardData = String.Empty; diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index 6d442b75a1..876e7ed628 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -243,7 +243,7 @@ namespace OpenSim.Services.Connectors if (metadata == null) return false; - asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type); + asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type, UUID.Zero); asset.Metadata = metadata; } asset.Data = data; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 608228db9c..bbe4a9404a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -131,7 +131,7 @@ namespace OpenSim.Services.Connectors.Hypergrid Bitmap m = new Bitmap(filename + ".jpg"); //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); byte[] imageData = OpenJPEG.EncodeFromImage(m, true); - AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture); + AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID); // !!! for now //info.RegionSettings.TerrainImageID = ass.FullID; diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index 1188b62b1f..98de514365 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -38,12 +38,9 @@ namespace OpenSim.Tests.Common /// /// Create an asset from the given data /// - /// - /// - /// - public static AssetBase CreateAsset(UUID assetUuid, string data) + public static AssetBase CreateAsset(UUID assetUuid, string data, UUID creatorID) { - AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); + AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID); asset.Data = Encoding.ASCII.GetBytes(data); return asset; } @@ -56,7 +53,7 @@ namespace OpenSim.Tests.Common /// public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog) { - AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); + AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID); asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)); return asset; }