From 6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Nov 2010 13:16:52 -0800 Subject: Global creator information working on MySQL DB and on load/save OARs. Creator name properly shown on the viewer as first.last @authority. New option added to save oar -profile=url. Migration on RegionStore making CreatorID be 255 chars. Moved Handling of user UUID -> name requests to a new module UserManagement/UserManagementModule. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Serialization') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index fb4ef28..fceeafa 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -34,6 +34,7 @@ using System.Xml; using log4net; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Scenes.Serialization @@ -46,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public class SceneObjectSerializer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private static IUserManagement m_UserManagement; /// /// Deserialize a scene object from the original xml format @@ -270,6 +273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization #region SOPXmlProcessors initialization m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop); m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID); + m_SOPXmlProcessors.Add("CreatorData", ProcessCreatorData); m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); @@ -412,6 +416,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.CreatorID = ReadUUID(reader, "CreatorID"); } + private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) + { + obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); + } + private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) { obj.FolderID = ReadUUID(reader, "FolderID"); @@ -1077,7 +1086,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); + WriteUUID(writer, "CreatorID", sop.CreatorID, options); + + if (sop.CreatorData != null && sop.CreatorData != string.Empty) + writer.WriteElementString("CreatorData", sop.CreatorData); + else if (options.ContainsKey("profile")) + { + if (m_UserManagement == null) + m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface(); + string name = m_UserManagement.GetUserName(sop.CreatorID); + writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); + } + WriteUUID(writer, "FolderID", sop.FolderID, options); writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); -- cgit v1.1 From c617d658dda92ad97de678d477a98c3df0659303 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Nov 2010 17:19:24 -0800 Subject: Added creator info across the board -- TaskInventoryItems and InventoryItems themselves. Tested. Seems to be working, main tests pass. Nothing done for IARs or HG transfers yet -- this only works for OARs for the time being. New migration in inventory table in order to make CreatorID varchar(255). --- .../Scenes/Serialization/SceneObjectSerializer.cs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index fceeafa..9cf5a39 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -331,6 +331,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); + m_TaskInventoryXmlProcessors.Add("CreatorData", ProcessTICreatorData); m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); @@ -707,6 +708,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization item.CreatorID = ReadUUID(reader, "CreatorID"); } + private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) + { + item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); + } + private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) { item.Description = reader.ReadElementContentAsString("Description", String.Empty); @@ -1102,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "FolderID", sop.FolderID, options); writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); - WriteTaskInventory(writer, sop.TaskInventory, options); + WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene); WriteUUID(writer, "UUID", sop.UUID, options); writer.WriteElementString("LocalId", sop.LocalId.ToString()); @@ -1226,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString(name, flagsStr); } - static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) { if (tinv.Count > 0) // otherwise skip this { @@ -1239,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "AssetID", item.AssetID, options); writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); writer.WriteElementString("CreationDate", item.CreationDate.ToString()); + + WriteUUID(writer, "CreatorID", item.CreatorID, options); + + if (item.CreatorData != null && item.CreatorData != string.Empty) + writer.WriteElementString("CreatorData", item.CreatorData); + else if (options.ContainsKey("profile")) + { + if (m_UserManagement == null) + m_UserManagement = scene.RequestModuleInterface(); + string name = m_UserManagement.GetUserName(item.CreatorID); + writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); + } + writer.WriteElementString("Description", item.Description); writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); writer.WriteElementString("Flags", item.Flags.ToString()); -- cgit v1.1