diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs (renamed from OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs) | 86 |
1 files changed, 36 insertions, 50 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs index 026b3c8..850bf14 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -25,71 +25,57 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using Nini.Config; | ||
29 | using log4net; | ||
28 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 32 | using System.Reflection; |
30 | using OpenMetaverse; | 33 | using System.IO; |
34 | using System.Net; | ||
35 | using System.Text; | ||
36 | using System.Text.RegularExpressions; | ||
37 | using System.Xml; | ||
38 | using System.Xml.Serialization; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenSim.Services.Interfaces; | ||
31 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
32 | using log4net; | 42 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | ||
33 | 44 | ||
34 | namespace OpenSim.Grid.AssetInventoryServer.Plugins | 45 | namespace OpenSim.Server.Handlers.Inventory |
35 | { | 46 | { |
36 | public class NullAuthenticationPlugin : IAuthenticationProvider | 47 | public class InventoryServerMoveItemsHandler : BaseStreamHandler |
37 | { | 48 | { |
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
39 | //private AssetInventoryServer m_server; | ||
40 | |||
41 | public NullAuthenticationPlugin() | ||
42 | { | ||
43 | } | ||
44 | |||
45 | #region IPlugin implementation | ||
46 | |||
47 | public void Initialise(AssetInventoryServer server) | ||
48 | { | ||
49 | //m_server = server; | ||
50 | |||
51 | m_log.Info("[NULLAUTHENTICATION]: Null Authentication loaded."); | ||
52 | } | ||
53 | 50 | ||
54 | /// <summary> | 51 | private IInventoryService m_InventoryService; |
55 | /// <para>Initialises asset interface</para> | ||
56 | /// </summary> | ||
57 | public void Initialise() | ||
58 | { | ||
59 | m_log.InfoFormat("[NULLAUTHENTICATION]: {0} cannot be default-initialized!", Name); | ||
60 | throw new PluginNotInitialisedException(Name); | ||
61 | } | ||
62 | |||
63 | public void Dispose() | ||
64 | { | ||
65 | } | ||
66 | 52 | ||
67 | public string Version | 53 | public InventoryServerMoveItemsHandler(IInventoryService service) : |
54 | base("PUT", "/inventory") | ||
68 | { | 55 | { |
69 | // TODO: this should be something meaningful and not hardcoded? | 56 | m_InventoryService = service; |
70 | get { return "0.1"; } | ||
71 | } | 57 | } |
72 | 58 | ||
73 | public string Name | 59 | public override byte[] Handle(string path, Stream request, |
60 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
74 | { | 61 | { |
75 | get { return "NullAuthentication"; } | 62 | XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>)); |
76 | } | 63 | List<InventoryItemBase> items = (List<InventoryItemBase>)xs.Deserialize(request); |
77 | 64 | ||
78 | #endregion IPlugin implementation | 65 | bool result = false; |
66 | string[] p = SplitParams(path); | ||
79 | 67 | ||
80 | public void AddIdentifier(UUID authToken, Uri identifier) | 68 | if (p.Length > 0) |
81 | { | 69 | { |
82 | } | 70 | UUID ownerID = UUID.Zero; |
83 | 71 | UUID.TryParse(p[0], out ownerID); | |
84 | public bool RemoveIdentifier(UUID authToken) | 72 | result = m_InventoryService.MoveItems(ownerID, items); |
85 | { | 73 | } |
86 | return true; | 74 | else |
87 | } | 75 | m_log.WarnFormat("[MOVEITEMS HANDLER]: ownerID not provided in request. Unable to serve."); |
88 | 76 | ||
89 | public bool TryGetIdentifier(UUID authToken, out Uri identifier) | 77 | xs = new XmlSerializer(typeof(bool)); |
90 | { | 78 | return ServerUtils.SerializeResult(xs, result); |
91 | identifier = null; | ||
92 | return true; | ||
93 | } | 79 | } |
94 | } | 80 | } |
95 | } | 81 | } |