aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
diff options
context:
space:
mode:
authorDr Scofield2008-09-22 11:20:09 +0000
committerDr Scofield2008-09-22 11:20:09 +0000
commit7def786ef4d62c2ffad8cea0cba7db033f8f0d27 (patch)
tree4da62a195714ea1206fd4d3b3688b22c31ce254c /OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
parentRemove the script engine identifier tag, so the compiler just sees (diff)
downloadopensim-SC-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.zip
opensim-SC-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.gz
opensim-SC-7def786ef4d62c2ffad8cea0cba7db033f8f0d27.tar.bz2
opensim-SC-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 'OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs35
1 files changed, 29 insertions, 6 deletions
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());