diff options
author | Diva Canto | 2012-09-20 15:49:22 -0700 |
---|---|---|
committer | Diva Canto | 2012-09-20 15:49:22 -0700 |
commit | 3089b6d824f1d4eb25ba12c5fd037153fdc92e1e (patch) | |
tree | f70c7a399cf2e2af599f25798a6b3c3b3d3f89d6 /OpenSim/Region | |
parent | Correctly override and call base OpenSimTestCase.SetUp() method in GridConnec... (diff) | |
download | opensim-SC_OLD-3089b6d824f1d4eb25ba12c5fd037153fdc92e1e.zip opensim-SC_OLD-3089b6d824f1d4eb25ba12c5fd037153fdc92e1e.tar.gz opensim-SC_OLD-3089b6d824f1d4eb25ba12c5fd037153fdc92e1e.tar.bz2 opensim-SC_OLD-3089b6d824f1d4eb25ba12c5fd037153fdc92e1e.tar.xz |
More HG2.0: Added permission policies in HGAsset Service based on asset types. The policies are given in the config. This is only half of the story. The other half, pertaining to exports/imports made by the sim, will be done next.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index eaadc1b..fcecbbc 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -93,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
93 | if (!url.EndsWith("/") && !url.EndsWith("=")) | 93 | if (!url.EndsWith("/") && !url.EndsWith("=")) |
94 | url = url + "/"; | 94 | url = url + "/"; |
95 | 95 | ||
96 | bool success = true; | ||
96 | // See long comment in AssetCache.AddAsset | 97 | // See long comment in AssetCache.AddAsset |
97 | if (!asset.Temporary || asset.Local) | 98 | if (!asset.Temporary || asset.Local) |
98 | { | 99 | { |
@@ -103,14 +104,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
103 | // not having a global naming infrastructure | 104 | // not having a global naming infrastructure |
104 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); | 105 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); |
105 | Copy(asset, asset1); | 106 | Copy(asset, asset1); |
106 | try | 107 | asset1.ID = url + asset.ID; |
107 | { | ||
108 | asset1.ID = url + asset.ID; | ||
109 | } | ||
110 | catch | ||
111 | { | ||
112 | m_log.Warn("[HG ASSET MAPPER]: Oops."); | ||
113 | } | ||
114 | 108 | ||
115 | AdjustIdentifiers(asset1.Metadata); | 109 | AdjustIdentifiers(asset1.Metadata); |
116 | if (asset1.Metadata.Type == (sbyte)AssetType.Object) | 110 | if (asset1.Metadata.Type == (sbyte)AssetType.Object) |
@@ -118,11 +112,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
118 | else | 112 | else |
119 | asset1.Data = asset.Data; | 113 | asset1.Data = asset.Data; |
120 | 114 | ||
121 | m_scene.AssetService.Store(asset1); | 115 | string id = m_scene.AssetService.Store(asset1); |
122 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | 116 | if (id == UUID.Zero.ToString()) |
117 | { | ||
118 | m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID); | ||
119 | success = false; | ||
120 | } | ||
121 | else | ||
122 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | ||
123 | } | 123 | } |
124 | return true; | 124 | return success; |
125 | } | 125 | } |
126 | else | 126 | else |
127 | m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); | 127 | m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); |
128 | 128 | ||
@@ -259,17 +259,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
259 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | 259 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); |
260 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); | 260 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); |
261 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | 261 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); |
262 | bool success = false; | ||
262 | foreach (UUID uuid in ids.Keys) | 263 | foreach (UUID uuid in ids.Keys) |
263 | { | 264 | { |
264 | asset = m_scene.AssetService.Get(uuid.ToString()); | 265 | asset = m_scene.AssetService.Get(uuid.ToString()); |
265 | if (asset == null) | 266 | if (asset == null) |
266 | m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); | 267 | m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); |
267 | else | 268 | else |
268 | PostAsset(userAssetURL, asset); | 269 | success = PostAsset(userAssetURL, asset); |
269 | } | 270 | } |
270 | 271 | ||
271 | // maybe all pieces got there... | 272 | // maybe all pieces got there... |
272 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); | 273 | if (!success) |
274 | m_log.DebugFormat("[HG ASSET MAPPER]: Problems posting item {0} to asset server {1}", assetID, userAssetURL); | ||
275 | else | ||
276 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); | ||
273 | 277 | ||
274 | } | 278 | } |
275 | else | 279 | else |