aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs126
3 files changed, 128 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index c1e92f5..b13b9d8 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); 158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
160 if (ids.ContainsKey(assetID))
161 ids.Remove(assetID);
160 foreach (UUID uuid in ids.Keys) 162 foreach (UUID uuid in ids.Keys)
161 FetchAsset(userAssetURL, uuid); 163 FetchAsset(userAssetURL, uuid);
162 164
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index b0555da..8ccc941 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
131 return ret; 131 return ret;
132 } 132 }
133 133
134 // DO NOT OVERRIDE THIS METHOD 134 // DO NOT OVERRIDE THE BASE METHOD
135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
136 SceneObjectGroup objectGroup, IClientAPI remoteClient) 136 SceneObjectGroup objectGroup, IClientAPI remoteClient)
137 { 137 {
@@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
139 139
140 if (!assetID.Equals(UUID.Zero)) 140 if (!assetID.Equals(UUID.Zero))
141 { 141 {
142 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); 142 if (remoteClient != null)
143 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
143 } 144 }
144 else 145 else
145 m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); 146 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
@@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
192 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 193 m_assMapper.Post(item.AssetID, receiver, userAssetServer);
193 } 194 }
194 195
195 #endregion 196 public override bool IsForeignUser(UUID userID, out string assetServerURL)
196
197 public bool IsForeignUser(UUID userID, out string assetServerURL)
198 { 197 {
199 assetServerURL = string.Empty; 198 assetServerURL = string.Empty;
200 UserAccount account = null; 199 UserAccount account = null;
@@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
217 216
218 return false; 217 return false;
219 } 218 }
219
220 #endregion
221
222 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
223 {
224 InventoryItemBase item = base.GetItem(agentID, itemID);
225
226 string userAssetServer = string.Empty;
227 if (IsForeignUser(agentID, out userAssetServer))
228 m_assMapper.Get(item.AssetID, agentID, userAssetServer);
229
230 return item;
231 }
220 } 232 }
221} 233}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 12b6aa0..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -322,6 +322,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
322 } 322 }
323 } 323 }
324 324
325 // Override and put into where it came from, if it came
326 // from anywhere in inventory
327 //
328 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
329 {
330 if (objectGroup.RootPart.FromFolderID != UUID.Zero)
331 {
332 InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
333 folder = m_Scene.InventoryService.GetFolder(f);
334 }
335 }
336
325 if (folder == null) // None of the above 337 if (folder == null) // None of the above
326 { 338 {
327 folder = new InventoryFolderBase(folderID); 339 folder = new InventoryFolderBase(folderID);
@@ -369,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
369 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
370 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
371 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
372 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
373 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
374 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
375 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
376 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
377 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
378 } 405 }
379 else 406 else
380 { 407 {
@@ -384,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
384 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
385 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
386 413
387 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
388 } 420 }
389 421
390 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -485,6 +517,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
485 SceneObjectGroup group 517 SceneObjectGroup group
486 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); 518 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
487 519
520 group.RootPart.FromFolderID = item.Folder;
521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
527
488 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
489 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
490 && !attachment) 530 && !attachment)
@@ -557,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
557 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
558 598
559 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
560 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
561 { 601 {
562 //Need to kill the for sale here 602 //Need to kill the for sale here
563 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -565,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565 605
566 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
567 { 607 {
568 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
569 { 609 {
570 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
571 { 611 part.NextOwnerMask = item.NextPermissions;
572 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
573 part.NextOwnerMask = item.NextPermissions;
574 part.GroupMask = 0; // DO NOT propagate here
575 }
576 } 613 }
577 614
578 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -581,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
581 618
582 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
583 { 620 {
584 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
585 { 622 {
586 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
587 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
588 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
589 }
590 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
591 {
592 part.EveryoneMask = item.EveryOnePermissions;
593 part.NextOwnerMask = item.NextPermissions;
594
595 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
596 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
597 } 630 }
598 631
599 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
@@ -639,6 +672,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
639 { 672 {
640 } 673 }
641 674
675 public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
676 {
677 InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
678 if (assetRequestItem == null)
679 {
680 ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
681 if (lib != null)
682 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
683 if (assetRequestItem == null)
684 return false;
685 }
686
687 // At this point, we need to apply perms
688 // only to notecards and scripts. All
689 // other asset types are always available
690 //
691 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
692 {
693 if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
694 {
695 remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
696 return false;
697 }
698 }
699 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
700 {
701 if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
702 {
703 remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
704 return false;
705 }
706 }
707
708 if (assetRequestItem.AssetID != requestID)
709 {
710 m_log.WarnFormat(
711 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
712 Name, requestID, itemID, assetRequestItem.AssetID);
713 return false;
714 }
715
716 return true;
717 }
718
719
720 public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
721 {
722 assetServerURL = string.Empty;
723 return false;
724 }
725
642 #endregion 726 #endregion
643 727
644 #region Misc 728 #region Misc
@@ -661,6 +745,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
661 return asset; 745 return asset;
662 } 746 }
663 747
748 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
749 {
750 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
751 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
752 assetRequestItem = invService.GetItem(assetRequestItem);
753 return assetRequestItem;
754 }
755
664 #endregion 756 #endregion
665 } 757 }
666} 758}