aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs71
1 files changed, 46 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 60f730d..cbe3456 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -94,6 +94,22 @@ namespace OpenSim.Region.Framework.Scenes
94 94
95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
96 { 96 {
97 InventoryFolderBase folder;
98
99 if (item.Folder == UUID.Zero)
100 {
101 folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType);
102 if (folder == null)
103 {
104 folder = InventoryService.GetRootFolder(AgentID);
105
106 if (folder == null)
107 return;
108 }
109
110 item.Folder = folder.ID;
111 }
112
97 if (InventoryService.AddItem(item)) 113 if (InventoryService.AddItem(item))
98 { 114 {
99 int userlevel = 0; 115 int userlevel = 0;
@@ -214,8 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
214 { 230 {
215 // Needs to determine which engine was running it and use that 231 // Needs to determine which engine was running it and use that
216 // 232 //
217 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 233 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0);
218 errors = part.Inventory.GetScriptErrors(item.ItemID);
219 } 234 }
220 else 235 else
221 { 236 {
@@ -382,29 +397,31 @@ namespace OpenSim.Region.Framework.Scenes
382 itemCopy.InvType = item.InvType; 397 itemCopy.InvType = item.InvType;
383 itemCopy.Folder = recipientFolderId; 398 itemCopy.Folder = recipientFolderId;
384 399
385 if (Permissions.PropagatePermissions()) 400 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 401 {
402 // First, make sore base is limited to the next perms
403 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions;
404 // By default, current equals base
405 itemCopy.CurrentPermissions = itemCopy.BasePermissions;
406
407 // If this is an object, replace current perms
408 // with folded perms
387 if (item.InvType == (int)InventoryType.Object) 409 if (item.InvType == (int)InventoryType.Object)
388 { 410 {
389 itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); 411 itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
390 itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; 412 itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13;
391 }
392 else
393 {
394 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions;
395 } 413 }
396 414
397 itemCopy.CurrentPermissions = itemCopy.BasePermissions; 415 // Ensure there is no escalation
398 if ((item.CurrentPermissions & 8) != 0) // Propagate slam bit 416 itemCopy.CurrentPermissions &= item.NextPermissions;
399 { 417
400 itemCopy.BasePermissions &= item.NextPermissions; 418 // Need slam bit on xfer
401 itemCopy.CurrentPermissions = itemCopy.BasePermissions; 419 itemCopy.CurrentPermissions |= 8;
402 itemCopy.CurrentPermissions |= 8;
403 }
404 420
405 itemCopy.NextPermissions = item.NextPermissions; 421 itemCopy.NextPermissions = item.NextPermissions;
406 itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; 422
407 itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; 423 itemCopy.EveryOnePermissions = 0;
424 itemCopy.GroupPermissions = 0;
408 } 425 }
409 else 426 else
410 { 427 {
@@ -834,8 +851,12 @@ namespace OpenSim.Region.Framework.Scenes
834 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) 851 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
835 { 852 {
836 SceneObjectPart part = GetSceneObjectPart(localID); 853 SceneObjectPart part = GetSceneObjectPart(localID);
837 SceneObjectGroup group = part.ParentGroup; 854 SceneObjectGroup group = null;
838 if (group != null) 855 if (part != null)
856 {
857 group = part.ParentGroup;
858 }
859 if (part != null && group != null)
839 { 860 {
840 TaskInventoryItem item = group.GetInventoryItem(localID, itemID); 861 TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
841 if (item == null) 862 if (item == null)
@@ -895,12 +916,12 @@ namespace OpenSim.Region.Framework.Scenes
895 916
896 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 917 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
897 { 918 {
919 agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions;
898 if (taskItem.InvType == (int)InventoryType.Object) 920 if (taskItem.InvType == (int)InventoryType.Object)
899 agentItem.BasePermissions = taskItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); 921 agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13);
900 else 922 agentItem.CurrentPermissions = agentItem.BasePermissions ;
901 agentItem.BasePermissions = taskItem.BasePermissions; 923
902 agentItem.BasePermissions &= taskItem.NextPermissions; 924 agentItem.CurrentPermissions |= 8;
903 agentItem.CurrentPermissions = agentItem.BasePermissions | 8;
904 agentItem.NextPermissions = taskItem.NextPermissions; 925 agentItem.NextPermissions = taskItem.NextPermissions;
905 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; 926 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions;
906 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 927 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;