* stop inventory item creation via REST falling over on any included assets that are not inline (UUID only)
* make rest inventory item xml output use 'invtype' for inventory type rather than just 'type'. This makes it symmetrical with input xml0.6.1-post-fixes
parent
5a0fa4f34c
commit
4699cd7957
|
@ -1293,9 +1293,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method generates XML that describes an instance of InventoryItemBase.
|
/// This method generates XML that describes an instance of InventoryItemBase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name=rdata>HTTP service request work area</param>
|
/// <param name="rdata">HTTP service request work area</param>
|
||||||
/// <param name=i>The item to be formatted</param>
|
/// <param name="i">The item to be formatted</param>
|
||||||
/// <param name=indent>Pretty print indentation</param>
|
/// <param name="indent">Pretty print indentation</param>
|
||||||
private void formatItem(InventoryRequestData rdata, InventoryItemBase i, string indent)
|
private void formatItem(InventoryRequestData rdata, InventoryItemBase i, string indent)
|
||||||
{
|
{
|
||||||
Rest.Log.DebugFormat("{0} Item : {1} {2} {3} Type = {4}, AssetType = {5}",
|
Rest.Log.DebugFormat("{0} Item : {1} {2} {3} Type = {4}, AssetType = {5}",
|
||||||
|
@ -1310,7 +1310,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
rdata.writer.WriteAttributeString("owner", String.Empty, i.Owner.ToString());
|
rdata.writer.WriteAttributeString("owner", String.Empty, i.Owner.ToString());
|
||||||
rdata.writer.WriteAttributeString("creator", String.Empty, i.Creator.ToString());
|
rdata.writer.WriteAttributeString("creator", String.Empty, i.Creator.ToString());
|
||||||
rdata.writer.WriteAttributeString("creationdate", String.Empty, i.CreationDate.ToString());
|
rdata.writer.WriteAttributeString("creationdate", String.Empty, i.CreationDate.ToString());
|
||||||
rdata.writer.WriteAttributeString("type", String.Empty, i.InvType.ToString());
|
rdata.writer.WriteAttributeString("invtype", String.Empty, i.InvType.ToString());
|
||||||
rdata.writer.WriteAttributeString("assettype", String.Empty, i.AssetType.ToString());
|
rdata.writer.WriteAttributeString("assettype", String.Empty, i.AssetType.ToString());
|
||||||
rdata.writer.WriteAttributeString("groupowned", String.Empty, i.GroupOwned.ToString());
|
rdata.writer.WriteAttributeString("groupowned", String.Empty, i.GroupOwned.ToString());
|
||||||
rdata.writer.WriteAttributeString("groupid", String.Empty, i.GroupID.ToString());
|
rdata.writer.WriteAttributeString("groupid", String.Empty, i.GroupID.ToString());
|
||||||
|
@ -1456,36 +1456,38 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
switch (ic.xml.NodeType)
|
switch (ic.xml.NodeType)
|
||||||
{
|
{
|
||||||
case XmlNodeType.Element :
|
case XmlNodeType.Element:
|
||||||
Rest.Log.DebugFormat("{0} StartElement: <{1}>",
|
Rest.Log.DebugFormat("{0} StartElement: <{1}>",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
|
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
case "Folder" :
|
case "Folder":
|
||||||
Rest.Log.DebugFormat("{0} Processing {1} element",
|
Rest.Log.DebugFormat("{0} Processing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
CollectFolder(ic);
|
CollectFolder(ic);
|
||||||
break;
|
break;
|
||||||
case "Item" :
|
case "Item":
|
||||||
Rest.Log.DebugFormat("{0} Processing {1} element",
|
Rest.Log.DebugFormat("{0} Processing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
CollectItem(ic);
|
CollectItem(ic);
|
||||||
break;
|
break;
|
||||||
case "Asset" :
|
case "Asset":
|
||||||
Rest.Log.DebugFormat("{0} Processing {1} element",
|
Rest.Log.DebugFormat("{0} Processing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
CollectAsset(ic);
|
CollectAsset(ic);
|
||||||
break;
|
break;
|
||||||
case "Permissions" :
|
case "Permissions":
|
||||||
Rest.Log.DebugFormat("{0} Processing {1} element",
|
Rest.Log.DebugFormat("{0} Processing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
CollectPermissions(ic);
|
CollectPermissions(ic);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Ignoring {1} element",
|
Rest.Log.DebugFormat("{0} Ignoring {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This stinks, but the ReadElement call above not only reads
|
// This stinks, but the ReadElement call above not only reads
|
||||||
// the imbedded data, but also consumes the end tag for Asset
|
// the imbedded data, but also consumes the end tag for Asset
|
||||||
// and moves the element pointer on to the containing Item's
|
// and moves the element pointer on to the containing Item's
|
||||||
|
@ -1501,32 +1503,32 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
case XmlNodeType.EndElement :
|
case XmlNodeType.EndElement :
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
case "Folder" :
|
case "Folder":
|
||||||
Rest.Log.DebugFormat("{0} Completing {1} element",
|
Rest.Log.DebugFormat("{0} Completing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
ic.Pop();
|
ic.Pop();
|
||||||
break;
|
break;
|
||||||
case "Item" :
|
case "Item":
|
||||||
Rest.Log.DebugFormat("{0} Completing {1} element",
|
Rest.Log.DebugFormat("{0} Completing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
Validate(ic);
|
Validate(ic);
|
||||||
break;
|
break;
|
||||||
case "Asset" :
|
case "Asset":
|
||||||
Rest.Log.DebugFormat("{0} Completing {1} element",
|
Rest.Log.DebugFormat("{0} Completing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
break;
|
break;
|
||||||
case "Permissions" :
|
case "Permissions":
|
||||||
Rest.Log.DebugFormat("{0} Completing {1} element",
|
Rest.Log.DebugFormat("{0} Completing {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Ignoring {1} element",
|
Rest.Log.DebugFormat("{0} Ignoring {1} element",
|
||||||
MsgId, ic.xml.Name);
|
MsgId, ic.xml.Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>",
|
Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>",
|
||||||
MsgId, ic.xml.NodeType, ic.xml.Value);
|
MsgId, ic.xml.NodeType, ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
|
@ -1592,25 +1594,25 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
ic.xml.MoveToAttribute(i);
|
ic.xml.MoveToAttribute(i);
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
case "name" :
|
case "name":
|
||||||
result.Name = ic.xml.Value;
|
result.Name = ic.xml.Value;
|
||||||
break;
|
break;
|
||||||
case "uuid" :
|
case "uuid":
|
||||||
result.ID = new UUID(ic.xml.Value);
|
result.ID = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "parent" :
|
case "parent":
|
||||||
result.ParentID = new UUID(ic.xml.Value);
|
result.ParentID = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "owner" :
|
case "owner":
|
||||||
result.Owner = new UUID(ic.xml.Value);
|
result.Owner = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "type" :
|
case "type":
|
||||||
result.Type = Int16.Parse(ic.xml.Value);
|
result.Type = Int16.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "version" :
|
case "version":
|
||||||
result.Version = UInt16.Parse(ic.xml.Value);
|
result.Version = UInt16.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Folder: unrecognized attribute: {1}:{2}",
|
Rest.Log.DebugFormat("{0} Folder: unrecognized attribute: {1}:{2}",
|
||||||
MsgId, ic.xml.Name, ic.xml.Value);
|
MsgId, ic.xml.Name, ic.xml.Value);
|
||||||
ic.Fail(Rest.HttpStatusCodeBadRequest, String.Format("unrecognized attribute <{0}>",
|
ic.Fail(Rest.HttpStatusCodeBadRequest, String.Format("unrecognized attribute <{0}>",
|
||||||
|
@ -1704,50 +1706,50 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
case "name" :
|
case "name":
|
||||||
result.Name = ic.xml.Value;
|
result.Name = ic.xml.Value;
|
||||||
break;
|
break;
|
||||||
case "desc" :
|
case "desc":
|
||||||
result.Description = ic.xml.Value;
|
result.Description = ic.xml.Value;
|
||||||
break;
|
break;
|
||||||
case "uuid" :
|
case "uuid":
|
||||||
result.ID = new UUID(ic.xml.Value);
|
result.ID = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "folder" :
|
case "folder":
|
||||||
result.Folder = new UUID(ic.xml.Value);
|
result.Folder = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "owner" :
|
case "owner":
|
||||||
result.Owner = new UUID(ic.xml.Value);
|
result.Owner = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "invtype" :
|
case "invtype":
|
||||||
result.InvType = Int32.Parse(ic.xml.Value);
|
result.InvType = Int32.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "creator" :
|
case "creator":
|
||||||
result.Creator = new UUID(ic.xml.Value);
|
result.Creator = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "assettype" :
|
case "assettype":
|
||||||
result.AssetType = Int32.Parse(ic.xml.Value);
|
result.AssetType = Int32.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "groupowned" :
|
case "groupowned":
|
||||||
result.GroupOwned = Boolean.Parse(ic.xml.Value);
|
result.GroupOwned = Boolean.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "groupid" :
|
case "groupid":
|
||||||
result.GroupID = new UUID(ic.xml.Value);
|
result.GroupID = new UUID(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "flags" :
|
case "flags":
|
||||||
result.Flags = UInt32.Parse(ic.xml.Value);
|
result.Flags = UInt32.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "creationdate" :
|
case "creationdate":
|
||||||
result.CreationDate = Int32.Parse(ic.xml.Value);
|
result.CreationDate = Int32.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "saletype" :
|
case "saletype":
|
||||||
result.SaleType = Byte.Parse(ic.xml.Value);
|
result.SaleType = Byte.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
case "saleprice" :
|
case "saleprice":
|
||||||
result.SalePrice = Int32.Parse(ic.xml.Value);
|
result.SalePrice = Int32.Parse(ic.xml.Value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Item: Unrecognized attribute: {1}:{2}",
|
Rest.Log.DebugFormat("{0} Item: Unrecognized attribute: {1}:{2}",
|
||||||
MsgId, ic.xml.Name, ic.xml.Value);
|
MsgId, ic.xml.Name, ic.xml.Value);
|
||||||
ic.Fail(Rest.HttpStatusCodeBadRequest, String.Format("unrecognized attribute",
|
ic.Fail(Rest.HttpStatusCodeBadRequest, String.Format("unrecognized attribute",
|
||||||
|
@ -1786,8 +1788,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
Rest.Log.DebugFormat("{0} Interpret asset element", MsgId);
|
Rest.Log.DebugFormat("{0} Interpret asset element", MsgId);
|
||||||
|
|
||||||
AssetBase asset = null;
|
|
||||||
|
|
||||||
string name = String.Empty;
|
string name = String.Empty;
|
||||||
string desc = String.Empty;
|
string desc = String.Empty;
|
||||||
sbyte type = (sbyte) AssetType.Unknown;
|
sbyte type = (sbyte) AssetType.Unknown;
|
||||||
|
@ -1807,7 +1807,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
ic.xml.MoveToAttribute(i);
|
ic.xml.MoveToAttribute(i);
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
|
|
||||||
case "name" :
|
case "name" :
|
||||||
name = ic.xml.Value;
|
name = ic.xml.Value;
|
||||||
break;
|
break;
|
||||||
|
@ -1871,6 +1870,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
AssetBase asset = null;
|
||||||
string b64string = null;
|
string b64string = null;
|
||||||
|
|
||||||
// Generate a UUID if none were given, and generally none should
|
// Generate a UUID if none were given, and generally none should
|
||||||
|
@ -1912,10 +1912,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
ic.Item.AssetID = uuid;
|
ic.Item.AssetID = uuid;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ic.Push(asset);
|
ic.Push(asset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store any permissions information provided by the request.
|
/// Store any permissions information provided by the request.
|
||||||
|
@ -1931,22 +1931,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
ic.xml.MoveToAttribute(i);
|
ic.xml.MoveToAttribute(i);
|
||||||
switch (ic.xml.Name)
|
switch (ic.xml.Name)
|
||||||
{
|
{
|
||||||
case "current" :
|
case "current":
|
||||||
ic.CurrentPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
ic.CurrentPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
||||||
break;
|
break;
|
||||||
case "next" :
|
case "next":
|
||||||
ic.NextPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
ic.NextPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
||||||
break;
|
break;
|
||||||
case "group" :
|
case "group":
|
||||||
ic.GroupPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
ic.GroupPermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
||||||
break;
|
break;
|
||||||
case "everyone" :
|
case "everyone":
|
||||||
ic.EveryOnePermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
ic.EveryOnePermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
||||||
break;
|
break;
|
||||||
case "base" :
|
case "base":
|
||||||
ic.BasePermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
ic.BasePermissions = UInt32.Parse(ic.xml.Value, System.Globalization.NumberStyles.HexNumber);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
Rest.Log.DebugFormat("{0} Permissions: invalid attribute {1}:{2}",
|
Rest.Log.DebugFormat("{0} Permissions: invalid attribute {1}:{2}",
|
||||||
MsgId,ic.xml.Name, ic.xml.Value);
|
MsgId,ic.xml.Name, ic.xml.Value);
|
||||||
ic.Fail(Rest.HttpStatusCodeBadRequest,
|
ic.Fail(Rest.HttpStatusCodeBadRequest,
|
||||||
|
|
Loading…
Reference in New Issue