diff options
author | Melanie | 2010-05-09 17:56:52 +0100 |
---|---|---|
committer | Melanie | 2010-05-09 17:56:52 +0100 |
commit | 60357d3778c95a47481f790803b7af39c70cde9c (patch) | |
tree | cc49f9da3a6907c32d3e8de31c1d811b11477d30 /OpenSim/Server | |
parent | Add a field asset_flags and a corresponding enum to the asset database. This (diff) | |
download | opensim-SC-60357d3778c95a47481f790803b7af39c70cde9c.zip opensim-SC-60357d3778c95a47481f790803b7af39c70cde9c.tar.gz opensim-SC-60357d3778c95a47481f790803b7af39c70cde9c.tar.bz2 opensim-SC-60357d3778c95a47481f790803b7af39c70cde9c.tar.xz |
Implement the "delete" path for assets. Adds a new option to allow remote asset deletion in robust handler.
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 4 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index f7eb292..b6425f4 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -59,9 +59,11 @@ namespace OpenSim.Server.Handlers.Asset | |||
59 | m_AssetService = | 59 | m_AssetService = |
60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
61 | 61 | ||
62 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); | ||
63 | |||
62 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 64 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); |
63 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 65 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); |
64 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); | 66 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); |
65 | } | 67 | } |
66 | } | 68 | } |
67 | } | 69 | } |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index f33bb90..8014fb5 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | |||
@@ -47,11 +47,13 @@ namespace OpenSim.Server.Handlers.Asset | |||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private IAssetService m_AssetService; | 49 | private IAssetService m_AssetService; |
50 | protected bool m_allowDelete; | ||
50 | 51 | ||
51 | public AssetServerDeleteHandler(IAssetService service) : | 52 | public AssetServerDeleteHandler(IAssetService service, bool allowDelete) : |
52 | base("DELETE", "/assets") | 53 | base("DELETE", "/assets") |
53 | { | 54 | { |
54 | m_AssetService = service; | 55 | m_AssetService = service; |
56 | m_allowDelete = allowDelete; | ||
55 | } | 57 | } |
56 | 58 | ||
57 | public override byte[] Handle(string path, Stream request, | 59 | public override byte[] Handle(string path, Stream request, |
@@ -61,9 +63,9 @@ namespace OpenSim.Server.Handlers.Asset | |||
61 | 63 | ||
62 | string[] p = SplitParams(path); | 64 | string[] p = SplitParams(path); |
63 | 65 | ||
64 | if (p.Length > 0) | 66 | if (p.Length > 0 && m_allowDelete) |
65 | { | 67 | { |
66 | // result = m_AssetService.Delete(p[0]); | 68 | result = m_AssetService.Delete(p[0]); |
67 | } | 69 | } |
68 | 70 | ||
69 | XmlSerializer xs = new XmlSerializer(typeof(bool)); | 71 | XmlSerializer xs = new XmlSerializer(typeof(bool)); |