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).
This commit is contained in:
Diva Canto
2010-11-21 17:19:24 -08:00
parent af8c8197ab
commit c617d658dd
24 changed files with 272 additions and 53 deletions

View File

@@ -426,6 +426,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase itemCopy = new InventoryItemBase();
itemCopy.Owner = recipient;
itemCopy.CreatorId = item.CreatorId;
itemCopy.CreatorData = item.CreatorData;
itemCopy.ID = UUID.Random();
itemCopy.AssetID = item.AssetID;
itemCopy.Description = item.Description;
@@ -699,13 +700,13 @@ namespace OpenSim.Region.Framework.Scenes
if (remoteClient.AgentId == oldAgentID)
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
else
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
}
@@ -755,11 +756,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="asset"></param>
/// <param name="invType"></param>
/// <param name="nextOwnerMask"></param>
private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID,
private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID,
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
{
CreateNewInventoryItem(
remoteClient, creatorID, folderID, name, flags, callbackID, asset, invType,
remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
}
@@ -774,12 +775,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="nextOwnerMask"></param>
/// <param name="creationDate"></param>
private void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{
InventoryItemBase item = new InventoryItemBase();
item.Owner = remoteClient.AgentId;
item.CreatorId = creatorID;
item.CreatorData = creatorData;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
@@ -859,7 +861,7 @@ namespace OpenSim.Region.Framework.Scenes
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);
CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
}
else
{
@@ -901,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes
asset.Description = description;
CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType,
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
}
@@ -1025,6 +1027,7 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.ID = UUID.Random();
agentItem.CreatorId = taskItem.CreatorID.ToString();
agentItem.CreatorData = taskItem.CreatorData;
agentItem.Owner = destAgent;
agentItem.AssetID = taskItem.AssetID;
agentItem.Description = taskItem.Description;
@@ -1226,6 +1229,7 @@ namespace OpenSim.Region.Framework.Scenes
destTaskItem.ItemID = UUID.Random();
destTaskItem.CreatorID = srcTaskItem.CreatorID;
destTaskItem.CreatorData = srcTaskItem.CreatorData;
destTaskItem.AssetID = srcTaskItem.AssetID;
destTaskItem.GroupID = destPart.GroupID;
destTaskItem.OwnerID = destPart.OwnerID;
@@ -1638,6 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes
destTaskItem.ItemID = UUID.Random();
destTaskItem.CreatorID = srcTaskItem.CreatorID;
destTaskItem.CreatorData = srcTaskItem.CreatorData;
destTaskItem.AssetID = srcTaskItem.AssetID;
destTaskItem.GroupID = destPart.GroupID;
destTaskItem.OwnerID = destPart.OwnerID;
@@ -1844,6 +1849,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase();
item.CreatorId = grp.RootPart.CreatorID.ToString();
item.CreatorData = grp.RootPart.CreatorData;
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;

View File

@@ -449,12 +449,17 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public string CreatorData
public string CreatorData // = <profile url>;<name>
{
get { return m_creatorData; }
set { m_creatorData = value; }
}
/// <summary>
/// Used by the DB layer to retrieve / store the entire user identification.
/// The identification can either be a simple UUID or a string of the form
/// uuid[;profile_url[;name]]
/// </summary>
public string CreatorIdentification
{
get

View File

@@ -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<string, object> options)
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> 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<IUserManagement>();
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());