diff options
author | Dr Scofield | 2008-09-22 11:20:09 +0000 |
---|---|---|
committer | Dr Scofield | 2008-09-22 11:20:09 +0000 |
commit | 7def786ef4d62c2ffad8cea0cba7db033f8f0d27 (patch) | |
tree | 4da62a195714ea1206fd4d3b3688b22c31ce254c /OpenSim/ApplicationPlugins/Rest | |
parent | Remove the script engine identifier tag, so the compiler just sees (diff) | |
download | opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.zip opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.gz opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.bz2 opensim-SC_OLD-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.xz |
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.
Diffstat (limited to '')
6 files changed, 38 insertions, 9 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 21fcf92..d7935bc 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | |||
@@ -392,7 +392,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
392 | 392 | ||
393 | /// Supported Digest algorithms | 393 | /// Supported Digest algorithms |
394 | 394 | ||
395 | public const string Digest_MD5 = "MD5"; // assumedd efault if omitted | 395 | public const string Digest_MD5 = "MD5"; // assumed default if omitted |
396 | public const string Digest_MD5Sess = "MD5-sess"; | 396 | public const string Digest_MD5Sess = "MD5-sess"; |
397 | 397 | ||
398 | public const string Qop_Auth = "auth"; | 398 | public const string Qop_Auth = "auth"; |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 18a0baf..8db3fde 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
45 | public class RestAppearanceServices : IRest | 45 | public class RestAppearanceServices : IRest |
46 | { | 46 | { |
47 | private static readonly int PARM_USERID = 0; | 47 | private static readonly int PARM_USERID = 0; |
48 | //private static readonly int PARM_PATH = 1; | 48 | // private static readonly int PARM_PATH = 1; |
49 | 49 | ||
50 | private bool enabled = false; | 50 | private bool enabled = false; |
51 | private string qPrefix = "appearance"; | 51 | private string qPrefix = "appearance"; |
@@ -166,6 +166,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
166 | 166 | ||
167 | try | 167 | try |
168 | { | 168 | { |
169 | // digest scheme seems borked: disable it for the time | ||
170 | // being | ||
171 | rdata.scheme = Rest.AS_BASIC; | ||
169 | if (!rdata.IsAuthenticated) | 172 | if (!rdata.IsAuthenticated) |
170 | { | 173 | { |
171 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); | 174 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); |
@@ -335,7 +338,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
335 | AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); | 338 | AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); |
336 | rdata.userAppearance = new AvatarAppearance(); | 339 | rdata.userAppearance = new AvatarAppearance(); |
337 | 340 | ||
338 | rdata.userAppearance.Owner = old.Owner; | 341 | rdata.userAppearance.Owner = old.Owner; |
342 | rdata.userAppearance.Serial = old.Serial; | ||
339 | 343 | ||
340 | if (GetUserAppearance(rdata)) | 344 | if (GetUserAppearance(rdata)) |
341 | { | 345 | { |
@@ -343,6 +347,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
343 | created = !modified; | 347 | created = !modified; |
344 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | 348 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); |
345 | } | 349 | } |
350 | else | ||
351 | { | ||
352 | created = true; | ||
353 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | ||
354 | } | ||
346 | 355 | ||
347 | if (created) | 356 | if (created) |
348 | { | 357 | { |
@@ -383,11 +392,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
383 | 392 | ||
384 | rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); | 393 | rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); |
385 | 394 | ||
386 | if (GetUserAppearance(rdata)) | 395 | // If the user exists then this is considered a modification regardless |
396 | // of what may, or may not be, specified in the payload. | ||
397 | |||
398 | if (rdata.userAppearance != null) | ||
387 | { | 399 | { |
388 | modified = rdata.userAppearance != null; | 400 | modified = true; |
389 | created = !modified; | 401 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); |
390 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | ||
391 | } | 402 | } |
392 | 403 | ||
393 | if (created) | 404 | if (created) |
@@ -465,6 +476,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
465 | rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value); | 476 | rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value); |
466 | indata = true; | 477 | indata = true; |
467 | } | 478 | } |
479 | if (xml.MoveToAttribute("Owner")) | ||
480 | { | ||
481 | rdata.userAppearance.Owner = xml.Value; | ||
482 | indata = true; | ||
483 | } | ||
484 | if (xml.MoveToAttribute("Serial")) | ||
485 | { | ||
486 | rdata.userAppearance.Serial = Convert.ToInt32(xml.Value); | ||
487 | indata = true; | ||
488 | } | ||
468 | break; | 489 | break; |
469 | case "Body" : | 490 | case "Body" : |
470 | if (xml.MoveToAttribute("Item")) | 491 | if (xml.MoveToAttribute("Item")) |
@@ -687,6 +708,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
687 | 708 | ||
688 | rdata.writer.WriteStartElement("Appearance"); | 709 | rdata.writer.WriteStartElement("Appearance"); |
689 | rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString()); | 710 | rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString()); |
711 | rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString()); | ||
712 | rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString()); | ||
690 | 713 | ||
691 | rdata.writer.WriteStartElement("Body"); | 714 | rdata.writer.WriteStartElement("Body"); |
692 | rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString()); | 715 | rdata.writer.WriteAttributeString("Item",rdata.userAppearance.BodyItem.ToString()); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index b67922f..7a6d4af 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | |||
@@ -130,6 +130,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
130 | 130 | ||
131 | try | 131 | try |
132 | { | 132 | { |
133 | // digest scheme seems borked: disable it for the time | ||
134 | // being | ||
135 | rdata.scheme = Rest.AS_BASIC; | ||
133 | if (!rdata.IsAuthenticated) | 136 | if (!rdata.IsAuthenticated) |
134 | { | 137 | { |
135 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated")); | 138 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized, String.Format("user \"{0}\" could not be authenticated")); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 0aad058..ab40b5d 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -167,6 +167,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
167 | 167 | ||
168 | try | 168 | try |
169 | { | 169 | { |
170 | // digest scheme seems borked: disable it for the time | ||
171 | // being | ||
172 | rdata.scheme = Rest.AS_BASIC; | ||
170 | if (!rdata.IsAuthenticated) | 173 | if (!rdata.IsAuthenticated) |
171 | { | 174 | { |
172 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); | 175 | rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs index b24b5ed..b7c9027 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs | |||
@@ -235,7 +235,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
235 | ci = t.GetConstructor(parms); | 235 | ci = t.GetConstructor(parms); |
236 | ht = ci.Invoke(args); | 236 | ht = ci.Invoke(args); |
237 | tests.Add((ITest)ht); | 237 | tests.Add((ITest)ht); |
238 | Rest.Log.WarnFormat("{0} Test {1} added", MsgId, t); | 238 | Rest.Log.InfoFormat("{0} Test {1} added", MsgId, t); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | catch (Exception e) | 241 | catch (Exception e) |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index 54d8478..bd42473 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests | |||
65 | public void Initialize() | 65 | public void Initialize() |
66 | { | 66 | { |
67 | enabled = true; | 67 | enabled = true; |
68 | Rest.Log.InfoFormat("{0} Remote services initialize", MsgId); | 68 | Rest.Log.InfoFormat("{0} Remote services initialized", MsgId); |
69 | } | 69 | } |
70 | 70 | ||
71 | // Called by the plug-in to halt REST processing. Local processing is | 71 | // Called by the plug-in to halt REST processing. Local processing is |