diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | 86 |
1 files changed, 61 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 582b267..ba3a7c9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -91,9 +91,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
91 | if (name == Name) | 91 | if (name == Name) |
92 | { | 92 | { |
93 | m_Enabled = true; | 93 | m_Enabled = true; |
94 | 94 | ||
95 | InitialiseCommon(source); | 95 | InitialiseCommon(source); |
96 | 96 | ||
97 | m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name); | 97 | m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name); |
98 | 98 | ||
99 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; | 99 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; |
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
117 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 117 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
118 | 118 | ||
119 | m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(source, "serverside_object_permissions", | 119 | m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(source, "serverside_object_permissions", |
120 | new string[] { "Startup", "Permissions" }, true); | 120 | new string[] { "Startup", "Permissions" }, true); |
121 | 121 | ||
122 | } | 122 | } |
123 | } | 123 | } |
@@ -209,7 +209,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | public void PostInventoryAsset(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel) | 212 | private void PostInventoryAsset(InventoryItemBase item, int userlevel) |
213 | { | ||
214 | InventoryFolderBase f = m_Scene.InventoryService.GetFolderForType(item.Owner, FolderType.Trash); | ||
215 | if (f == null || (f != null && item.Folder != f.ID)) | ||
216 | PostInventoryAsset(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
217 | } | ||
218 | |||
219 | private void PostInventoryAsset(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel) | ||
213 | { | 220 | { |
214 | if (type == AssetType.Link) | 221 | if (type == AssetType.Link) |
215 | return; | 222 | return; |
@@ -241,26 +248,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
241 | } | 248 | } |
242 | 249 | ||
243 | 250 | ||
244 | /// | 251 | /// |
245 | /// CapsUpdateInventoryItemAsset | 252 | /// CapsUpdateInventoryItemAsset |
246 | /// | 253 | /// |
247 | public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | 254 | public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) |
248 | { | 255 | { |
249 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); | 256 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); |
250 | 257 | ||
251 | PostInventoryAsset(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0); | 258 | // We need to construct this here to satisfy the calling convention. |
259 | // Better this in two places than five formal params in all others. | ||
260 | InventoryItemBase item = new InventoryItemBase(); | ||
261 | item.Owner = remoteClient.AgentId; | ||
262 | item.AssetType = (int)AssetType.Unknown; | ||
263 | item.AssetID = newAssetID; | ||
264 | item.Name = String.Empty; | ||
265 | |||
266 | PostInventoryAsset(item, 0); | ||
252 | 267 | ||
253 | return newAssetID; | 268 | return newAssetID; |
254 | } | 269 | } |
255 | 270 | ||
256 | /// | 271 | /// |
257 | /// UpdateInventoryItemAsset | 272 | /// UpdateInventoryItemAsset |
258 | /// | 273 | /// |
259 | public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | 274 | public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) |
260 | { | 275 | { |
261 | if (base.UpdateInventoryItemAsset(ownerID, item, asset)) | 276 | if (base.UpdateInventoryItemAsset(ownerID, item, asset)) |
262 | { | 277 | { |
263 | PostInventoryAsset(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0); | 278 | PostInventoryAsset(item, 0); |
264 | return true; | 279 | return true; |
265 | } | 280 | } |
266 | 281 | ||
@@ -273,25 +288,45 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
273 | protected override void ExportAsset(UUID agentID, UUID assetID) | 288 | protected override void ExportAsset(UUID agentID, UUID assetID) |
274 | { | 289 | { |
275 | if (!assetID.Equals(UUID.Zero)) | 290 | if (!assetID.Equals(UUID.Zero)) |
276 | PostInventoryAsset(agentID, AssetType.Unknown, assetID, "", 0); | 291 | { |
292 | InventoryItemBase item = new InventoryItemBase(); | ||
293 | item.Owner = agentID; | ||
294 | item.AssetType = (int)AssetType.Unknown; | ||
295 | item.AssetID = assetID; | ||
296 | item.Name = String.Empty; | ||
297 | |||
298 | PostInventoryAsset(item, 0); | ||
299 | } | ||
277 | else | 300 | else |
301 | { | ||
278 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | 302 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); |
303 | } | ||
279 | } | 304 | } |
280 | 305 | ||
281 | /// | 306 | /// |
282 | /// RezObject | 307 | /// RezObject |
283 | /// | 308 | /// |
284 | public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | 309 | // compatibility do not use |
285 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 310 | public override SceneObjectGroup RezObject( |
286 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 311 | IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, |
312 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
313 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | ||
314 | { | ||
315 | return RezObject(remoteClient, itemID, UUID.Zero, RayEnd, RayStart, | ||
316 | RayTargetID, BypassRayCast, RayEndIsIntersection, | ||
317 | RezSelected, RemoveItem, fromTaskID, attachment); | ||
318 | } | ||
319 | |||
320 | public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, | ||
321 | UUID groupID, Vector3 RayEnd, Vector3 RayStart, | ||
322 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
323 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | ||
287 | { | 324 | { |
288 | m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); | 325 | //m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); |
289 | 326 | ||
290 | //if (fromTaskID.Equals(UUID.Zero)) | 327 | //if (fromTaskID.Equals(UUID.Zero)) |
291 | //{ | 328 | //{ |
292 | InventoryItemBase item = new InventoryItemBase(itemID); | 329 | InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); |
293 | item.Owner = remoteClient.AgentId; | ||
294 | item = m_Scene.InventoryService.GetItem(item); | ||
295 | //if (item == null) | 330 | //if (item == null) |
296 | //{ // Fetch the item | 331 | //{ // Fetch the item |
297 | // item = new InventoryItemBase(); | 332 | // item = new InventoryItemBase(); |
@@ -308,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
308 | //} | 343 | //} |
309 | 344 | ||
310 | // OK, we're done fetching. Pass it up to the default RezObject | 345 | // OK, we're done fetching. Pass it up to the default RezObject |
311 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 346 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, groupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
312 | RezSelected, RemoveItem, fromTaskID, attachment); | 347 | RezSelected, RemoveItem, fromTaskID, attachment); |
313 | 348 | ||
314 | return sog; | 349 | return sog; |
@@ -351,7 +386,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
351 | if (!m_CheckSeparateAssets) | 386 | if (!m_CheckSeparateAssets) |
352 | { | 387 | { |
353 | if (!UserManagementModule.IsLocalGridUser(userID)) | 388 | if (!UserManagementModule.IsLocalGridUser(userID)) |
354 | { // foreign | 389 | { // foreign |
355 | ScenePresence sp = null; | 390 | ScenePresence sp = null; |
356 | if (m_Scene.TryGetScenePresence(userID, out sp)) | 391 | if (m_Scene.TryGetScenePresence(userID, out sp)) |
357 | { | 392 | { |
@@ -489,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
489 | foreach (InventoryItemBase it in content.Items) | 524 | foreach (InventoryItemBase it in content.Items) |
490 | it.Name = it.Name + " (Unavailable)"; ; | 525 | it.Name = it.Name + " (Unavailable)"; ; |
491 | 526 | ||
492 | // Send the new names | 527 | // Send the new names |
493 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); | 528 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); |
494 | 529 | ||
495 | } | 530 | } |
@@ -506,16 +541,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
506 | 541 | ||
507 | #region Permissions | 542 | #region Permissions |
508 | 543 | ||
509 | private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene) | 544 | private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp) |
510 | { | 545 | { |
511 | if (m_bypassPermissions) return true; | 546 | if (m_bypassPermissions) return true; |
512 | 547 | ||
513 | if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer)) | 548 | if(sp == null || sog == null) |
549 | return false; | ||
550 | |||
551 | if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID)) | ||
514 | { | 552 | { |
515 | SceneObjectGroup sog = null; | 553 | if (sog.OwnerID == sp.UUID) |
516 | if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer) | ||
517 | return true; | 554 | return true; |
518 | |||
519 | return false; | 555 | return false; |
520 | } | 556 | } |
521 | 557 | ||
@@ -535,4 +571,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
535 | 571 | ||
536 | #endregion | 572 | #endregion |
537 | } | 573 | } |
538 | } \ No newline at end of file | 574 | } |