diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Asset/AssetServerConnector.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index ff45d94..ab81dd6 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -30,6 +30,7 @@ using System.IO; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
34 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
35 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
@@ -69,6 +70,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
69 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); | 70 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); |
70 | bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); | 71 | bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); |
71 | 72 | ||
73 | string redirectURL = serverConfig.GetString("RedirectURL", string.Empty); | ||
74 | |||
72 | AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; | 75 | AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; |
73 | 76 | ||
74 | if (!allowDelete) | 77 | if (!allowDelete) |
@@ -83,9 +86,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
83 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; | 86 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; |
84 | } | 87 | } |
85 | 88 | ||
86 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 89 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
87 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 90 | |
88 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); | 91 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, redirectURL)); |
92 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); | ||
93 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); | ||
94 | server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); | ||
89 | 95 | ||
90 | MainConsole.Instance.Commands.AddCommand("Assets", false, | 96 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
91 | "show asset", | 97 | "show asset", |
@@ -119,16 +125,14 @@ namespace OpenSim.Server.Handlers.Asset | |||
119 | 125 | ||
120 | if (asset == null || asset.Data.Length == 0) | 126 | if (asset == null || asset.Data.Length == 0) |
121 | { | 127 | { |
122 | MainConsole.Instance.Output("Asset not found"); | 128 | MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]); |
123 | return; | 129 | return; |
124 | } | 130 | } |
125 | 131 | ||
126 | m_AssetService.Delete(args[2]); | 132 | if (!m_AssetService.Delete(asset.ID)) |
127 | 133 | MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); | |
128 | //MainConsole.Instance.Output("Asset deleted"); | 134 | else |
129 | // TODO: Implement this | 135 | MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name); |
130 | |||
131 | MainConsole.Instance.Output("Asset deletion not supported by database"); | ||
132 | } | 136 | } |
133 | 137 | ||
134 | void HandleDumpAsset(string module, string[] args) | 138 | void HandleDumpAsset(string module, string[] args) |
@@ -214,4 +218,4 @@ namespace OpenSim.Server.Handlers.Asset | |||
214 | } | 218 | } |
215 | } | 219 | } |
216 | } | 220 | } |
217 | } \ No newline at end of file | 221 | } |