Move check to allow only deletion of maptiles up to AssetServerDeleteHandler from AssetService.
This allows us to use a common check for both AssetService and XAssetService. It also allows future console commands to delete an asset. As before, deletion of maptile assets is not allowed remotely unless this is explicitly configured.0.7.3-extended
parent
6391a2fad4
commit
7ae128abbe
|
@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
{
|
||||
public class AssetServerDeleteHandler : BaseStreamHandler
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_AssetService;
|
||||
protected bool m_allowDelete;
|
||||
|
@ -65,7 +65,18 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
if (p.Length > 0 && m_allowDelete)
|
||||
{
|
||||
result = m_AssetService.Delete(p[0]);
|
||||
string assetID = p[0];
|
||||
|
||||
AssetBase asset = m_AssetService.Get(assetID);
|
||||
if (asset != null && (int)(asset.Flags & AssetFlags.Maptile) != 0)
|
||||
{
|
||||
result = m_AssetService.Delete(assetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ASSET SERVER DELETE HANDLER]: Request to delete asset {0}, but flags are not Maptile", assetID);
|
||||
}
|
||||
}
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof(bool));
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
if (assetLoaderEnabled)
|
||||
{
|
||||
m_log.DebugFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
|
||||
m_log.DebugFormat("[ASSET SERVICE]: Loading default asset set from {0}", loaderArgs);
|
||||
|
||||
m_AssetLoader.ForEachDefaultXmlAsset(
|
||||
loaderArgs,
|
||||
|
@ -191,20 +191,7 @@ namespace OpenSim.Services.AssetService
|
|||
if (!UUID.TryParse(id, out assetID))
|
||||
return false;
|
||||
|
||||
AssetBase asset = m_Database.GetAsset(assetID);
|
||||
if (asset == null)
|
||||
return false;
|
||||
|
||||
if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
|
||||
{
|
||||
return m_Database.Delete(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue