* Insert profile references for creators for items saved into iars
parent
257fc5515a
commit
a61cbab799
|
@ -50,7 +50,22 @@ namespace OpenSim.Framework.Communications
|
||||||
public const string OSPA_PAIR_SEPARATOR = "=";
|
public const string OSPA_PAIR_SEPARATOR = "=";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make an OSPA given an avatar name
|
/// Make an OSPA given a user UUID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="commsManager"></param>
|
||||||
|
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
|
||||||
|
public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||||
|
if (userInfo != null)
|
||||||
|
return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Make an OSPA given a user name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -58,7 +73,7 @@ namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolve an osp string into the most suitable internal OpenSim identifier.
|
/// Resolve an osp string into the most suitable internal OpenSim identifier.
|
||||||
|
@ -74,7 +89,7 @@ namespace OpenSim.Framework.Communications
|
||||||
/// return that same string. If the input string was ospi data but no valid profile information has been found,
|
/// return that same string. If the input string was ospi data but no valid profile information has been found,
|
||||||
/// then returns null.
|
/// then returns null.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static string Resolve(string ospa, CommunicationsManager commsManager)
|
public static string ResolveOspa(string ospa, CommunicationsManager commsManager)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
|
m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class InventoryItemBase : InventoryNodeBase, ICloneable
|
public class InventoryItemBase : InventoryNodeBase, ICloneable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The inventory type of the item. This is slightly different from the asset type in some situations.
|
/// The inventory type of the item. This is slightly different from the asset type in some situations.
|
||||||
/// </summary>
|
/// </value>
|
||||||
public int InvType;
|
public int InvType;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The folder this item is contained in
|
/// The folder this item is contained in
|
||||||
/// </summary>
|
/// </value>
|
||||||
public UUID Folder;
|
public UUID Folder;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
|
@ -69,9 +69,9 @@ namespace OpenSim.Framework
|
||||||
/// </value>
|
/// </value>
|
||||||
public UUID CreatorIdAsUuid { get; private set; }
|
public UUID CreatorIdAsUuid { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The description of the inventory item (must be less than 64 characters)
|
/// The description of the inventory item (must be less than 64 characters)
|
||||||
/// </summary>
|
/// </value>
|
||||||
public string Description = String.Empty;
|
public string Description = String.Empty;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
|
@ -79,80 +79,69 @@ namespace OpenSim.Framework
|
||||||
/// </value>
|
/// </value>
|
||||||
public uint NextPermissions;
|
public uint NextPermissions;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// A mask containing permissions for the current owner (cannot be enforced)
|
/// A mask containing permissions for the current owner (cannot be enforced)
|
||||||
/// </summary>
|
/// </value>
|
||||||
public uint CurrentPermissions;
|
public uint CurrentPermissions;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public uint BasePermissions;
|
public uint BasePermissions;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public uint EveryOnePermissions;
|
public uint EveryOnePermissions;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public uint GroupPermissions;
|
public uint GroupPermissions;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
|
/// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
|
||||||
/// </summary>
|
/// </value>
|
||||||
public int AssetType;
|
public int AssetType;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The UUID of the associated asset on the asset server
|
/// The UUID of the associated asset on the asset server
|
||||||
/// </summary>
|
/// </value>
|
||||||
public UUID AssetID;
|
public UUID AssetID;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public UUID GroupID;
|
public UUID GroupID;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public bool GroupOwned;
|
public bool GroupOwned;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public int SalePrice;
|
public int SalePrice;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public byte SaleType;
|
public byte SaleType;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public uint Flags;
|
public uint Flags;
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </value>
|
||||||
public int CreationDate;
|
public int CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
|
||||||
public InventoryItemBase()
|
|
||||||
{
|
|
||||||
CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
InventoryItemBase clone = new InventoryItemBase();
|
return MemberwiseClone();
|
||||||
clone.AssetID = AssetID;
|
|
||||||
clone.AssetType = AssetType;
|
|
||||||
clone.BasePermissions = BasePermissions;
|
|
||||||
clone.CreationDate = CreationDate;
|
|
||||||
clone.CreatorId = CreatorId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Don't use the item ID that's in the file
|
// Don't use the item ID that's in the file
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
|
|
||||||
string ospResolvedId = OspResolver.Resolve(item.CreatorId, m_commsManager);
|
string ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
|
||||||
if (null != ospResolvedId)
|
if (null != ospResolvedId)
|
||||||
item.CreatorId = ospResolvedId;
|
item.CreatorId = ospResolvedId;
|
||||||
|
|
||||||
|
|
|
@ -125,13 +125,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID);
|
string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID);
|
||||||
|
|
||||||
string serialization = UserInventoryItemSerializer.Serialize(inventoryItem);
|
|
||||||
m_archive.WriteFile(filename, serialization);
|
|
||||||
|
|
||||||
// Record the creator of this item for user record purposes (which might go away soon)
|
// Record the creator of this item for user record purposes (which might go away soon)
|
||||||
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
||||||
|
|
||||||
m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids);
|
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
||||||
|
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_module.CommsManager);
|
||||||
|
|
||||||
|
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
||||||
|
m_archive.WriteFile(filename, serialization);
|
||||||
|
|
||||||
|
m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)saveItem.AssetType, m_assetUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue