cleanups in inventory REST code. also, disables digest authentications
for inventory REST calls for the time being, as firefox, curl, and also python's urllib2 cannot authenticate using digest auth. fix permission checking for prim inventory to be the same as for normal edit ops.0.6.0-stable
parent
b8a39a4dde
commit
7def786ef4
|
@ -392,7 +392,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
/// Supported Digest algorithms
|
/// Supported Digest algorithms
|
||||||
|
|
||||||
public const string Digest_MD5 = "MD5"; // assumedd efault if omitted
|
public const string Digest_MD5 = "MD5"; // assumed default if omitted
|
||||||
public const string Digest_MD5Sess = "MD5-sess";
|
public const string Digest_MD5Sess = "MD5-sess";
|
||||||
|
|
||||||
public const string Qop_Auth = "auth";
|
public const string Qop_Auth = "auth";
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
public class RestAppearanceServices : IRest
|
public class RestAppearanceServices : IRest
|
||||||
{
|
{
|
||||||
private static readonly int PARM_USERID = 0;
|
private static readonly int PARM_USERID = 0;
|
||||||
//private static readonly int PARM_PATH = 1;
|
// private static readonly int PARM_PATH = 1;
|
||||||
|
|
||||||
private bool enabled = false;
|
private bool enabled = false;
|
||||||
private string qPrefix = "appearance";
|
private string qPrefix = "appearance";
|
||||||
|
@ -166,6 +166,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// digest scheme seems borked: disable it for the time
|
||||||
|
// being
|
||||||
|
rdata.scheme = Rest.AS_BASIC;
|
||||||
if (!rdata.IsAuthenticated)
|
if (!rdata.IsAuthenticated)
|
||||||
{
|
{
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||||
|
@ -336,6 +339,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
rdata.userAppearance = new AvatarAppearance();
|
rdata.userAppearance = new AvatarAppearance();
|
||||||
|
|
||||||
rdata.userAppearance.Owner = old.Owner;
|
rdata.userAppearance.Owner = old.Owner;
|
||||||
|
rdata.userAppearance.Serial = old.Serial;
|
||||||
|
|
||||||
if (GetUserAppearance(rdata))
|
if (GetUserAppearance(rdata))
|
||||||
{
|
{
|
||||||
|
@ -343,6 +347,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
created = !modified;
|
created = !modified;
|
||||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
created = true;
|
||||||
|
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||||
|
}
|
||||||
|
|
||||||
if (created)
|
if (created)
|
||||||
{
|
{
|
||||||
|
@ -383,10 +392,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||||
|
|
||||||
if (GetUserAppearance(rdata))
|
// If the user exists then this is considered a modification regardless
|
||||||
|
// of what may, or may not be, specified in the payload.
|
||||||
|
|
||||||
|
if (rdata.userAppearance != null)
|
||||||
{
|
{
|
||||||
modified = rdata.userAppearance != null;
|
modified = true;
|
||||||
created = !modified;
|
|
||||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,6 +476,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
|
rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
|
||||||
indata = true;
|
indata = true;
|
||||||
}
|
}
|
||||||
|
if (xml.MoveToAttribute("Owner"))
|
||||||
|
{
|
||||||
|
rdata.userAppearance.Owner = xml.Value;
|
||||||
|
indata = true;
|
||||||
|
}
|
||||||
|
if (xml.MoveToAttribute("Serial"))
|
||||||
|
{
|
||||||
|
rdata.userAppearance.Serial = Convert.ToInt32(xml.Value);
|
||||||
|
indata = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Body" :
|
case "Body" :
|
||||||
if (xml.MoveToAttribute("Item"))
|
if (xml.MoveToAttribute("Item"))
|
||||||
|
@ -687,6 +708,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
rdata.writer.WriteStartElement("Appearance");
|
rdata.writer.WriteStartElement("Appearance");
|
||||||
rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
|
rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
|
||||||
|
rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
|
||||||
|
rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
|
||||||
|
|
||||||
rdata.writer.WriteStartElement("Body");
|
rdata.writer.WriteStartElement("Body");
|
||||||
rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString());
|
rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString());
|
||||||
|
|
|
@ -130,6 +130,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// digest scheme seems borked: disable it for the time
|
||||||
|
// being
|
||||||
|
rdata.scheme = Rest.AS_BASIC;
|
||||||
if (!rdata.IsAuthenticated)
|
if (!rdata.IsAuthenticated)
|
||||||
{
|
{
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated"));
|
rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated"));
|
||||||
|
|
|
@ -167,6 +167,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// digest scheme seems borked: disable it for the time
|
||||||
|
// being
|
||||||
|
rdata.scheme = Rest.AS_BASIC;
|
||||||
if (!rdata.IsAuthenticated)
|
if (!rdata.IsAuthenticated)
|
||||||
{
|
{
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||||
|
|
|
@ -235,7 +235,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
ci = t.GetConstructor(parms);
|
ci = t.GetConstructor(parms);
|
||||||
ht = ci.Invoke(args);
|
ht = ci.Invoke(args);
|
||||||
tests.Add((ITest)ht);
|
tests.Add((ITest)ht);
|
||||||
Rest.Log.WarnFormat("{0} Test {1} added", MsgId, t);
|
Rest.Log.InfoFormat("{0} Test {1} added", MsgId, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
enabled = true;
|
enabled = true;
|
||||||
Rest.Log.InfoFormat("{0} Remote services initialize", MsgId);
|
Rest.Log.InfoFormat("{0} Remote services initialized", MsgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by the plug-in to halt REST processing. Local processing is
|
// Called by the plug-in to halt REST processing. Local processing is
|
||||||
|
|
|
@ -5200,6 +5200,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.UpdateTaskInventory:
|
case PacketType.UpdateTaskInventory:
|
||||||
|
m_log.DebugFormat("[AMW] UpdateTaskInventory request");
|
||||||
UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
|
UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
|
||||||
if (OnUpdateTaskInventory != null)
|
if (OnUpdateTaskInventory != null)
|
||||||
{
|
{
|
||||||
|
@ -5266,7 +5267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.RezScript:
|
case PacketType.RezScript:
|
||||||
|
m_log.DebugFormat("[AMW] RezScript");
|
||||||
//Console.WriteLine(Pack.ToString());
|
//Console.WriteLine(Pack.ToString());
|
||||||
RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
|
RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
|
||||||
|
|
||||||
|
|
|
@ -1186,11 +1186,21 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.OwnerID != remoteClient.AgentId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
// replacing the following two checks with the
|
||||||
|
// ExternalChecks.ExternalChecksCanEditObject(...)
|
||||||
|
// call
|
||||||
|
|
||||||
|
// if (part.OwnerID != remoteClient.AgentId)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
|
TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
|
||||||
|
|
||||||
|
@ -1283,11 +1293,23 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
if (part.OwnerID != remoteClient.AgentId)
|
if (part.OwnerID != remoteClient.AgentId)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||||
// TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez
|
// TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez
|
||||||
|
|
Loading…
Reference in New Issue