aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2008-06-24 23:55:33 +0000
committerCharles Krinke2008-06-24 23:55:33 +0000
commitf6bf4c39be634bb8d1a03de5fd048edc54b7df50 (patch)
treefd178392c1ab29cb7b729a85811c34b7686e5dd2
parentMantis#5189. Thank you kindly, Matth for your patch (diff)
downloadopensim-SC-f6bf4c39be634bb8d1a03de5fd048edc54b7df50.zip
opensim-SC-f6bf4c39be634bb8d1a03de5fd048edc54b7df50.tar.gz
opensim-SC-f6bf4c39be634bb8d1a03de5fd048edc54b7df50.tar.bz2
opensim-SC-f6bf4c39be634bb8d1a03de5fd048edc54b7df50.tar.xz
Mantis#1587. Thank you kindly, Melanie for a patch that:
Add permissions magling to llGiveInventoryItem, correct some corner case functionality
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs49
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs39
4 files changed, 77 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 3580b99..517066d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -882,12 +882,6 @@ namespace OpenSim.Region.Environment.Scenes
882 return; 882 return;
883 } 883 }
884 884
885 // Only owner can copy
886 if (remoteClient.AgentId != taskItem.OwnerID)
887 {
888 return;
889 }
890
891 InventoryItemBase agentItem = new InventoryItemBase(); 885 InventoryItemBase agentItem = new InventoryItemBase();
892 886
893 agentItem.ID = LLUUID.Random(); 887 agentItem.ID = LLUUID.Random();
@@ -925,13 +919,13 @@ namespace OpenSim.Region.Environment.Scenes
925 } 919 }
926 920
927 /// <summary> 921 /// <summary>
928 /// <see>MoveTaskInventoryItem</see> 922 /// <see>ClientMoveTaskInventoryItem</see>
929 /// </summary> 923 /// </summary>
930 /// <param name="remoteClient"></param> 924 /// <param name="remoteClient"></param>
931 /// <param name="folderID"></param> 925 /// <param name="folderID"></param>
932 /// <param name="primLocalID"></param> 926 /// <param name="primLocalID"></param>
933 /// <param name="itemID"></param> 927 /// <param name="itemID"></param>
934 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) 928 public void ClientMoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
935 { 929 {
936 SceneObjectPart part = GetSceneObjectPart(primLocalId); 930 SceneObjectPart part = GetSceneObjectPart(primLocalId);
937 931
@@ -944,6 +938,15 @@ namespace OpenSim.Region.Environment.Scenes
944 938
945 return; 939 return;
946 } 940 }
941
942 TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
943
944 // Only owner can copy
945 if (remoteClient.AgentId != taskItem.OwnerID)
946 {
947 return;
948 }
949
947 MoveTaskInventoryItem(remoteClient, folderId, part, itemId); 950 MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
948 } 951 }
949 952
@@ -977,7 +980,7 @@ namespace OpenSim.Region.Environment.Scenes
977 /// <param name="destId"></param> 980 /// <param name="destId"></param>
978 /// <param name="part"></param> 981 /// <param name="part"></param>
979 /// <param name="itemId"></param> 982 /// <param name="itemId"></param>
980 public void CopyTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId) 983 public void MoveTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
981 { 984 {
982 TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId); 985 TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId);
983 986
@@ -1003,23 +1006,43 @@ namespace OpenSim.Region.Environment.Scenes
1003 destTaskItem.ItemID = LLUUID.Random(); 1006 destTaskItem.ItemID = LLUUID.Random();
1004 destTaskItem.CreatorID = srcTaskItem.CreatorID; 1007 destTaskItem.CreatorID = srcTaskItem.CreatorID;
1005 destTaskItem.AssetID = srcTaskItem.AssetID; 1008 destTaskItem.AssetID = srcTaskItem.AssetID;
1006 destTaskItem.GroupID = srcTaskItem.GroupID; 1009 destTaskItem.GroupID = destPart.GroupID;
1007 destTaskItem.OwnerID = srcTaskItem.OwnerID; 1010 destTaskItem.OwnerID = destPart.OwnerID;
1008 destTaskItem.ParentID = srcTaskItem.ParentID; 1011 destTaskItem.ParentID = destPart.UUID;
1009 destTaskItem.ParentPartID = srcTaskItem.ParentPartID; 1012 destTaskItem.ParentPartID = destPart.UUID;
1010 1013
1011 destTaskItem.BaseMask = srcTaskItem.BaseMask; 1014 destTaskItem.BaseMask = srcTaskItem.BaseMask;
1012 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask; 1015 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
1013 destTaskItem.GroupMask = srcTaskItem.GroupMask; 1016 destTaskItem.GroupMask = srcTaskItem.GroupMask;
1014 destTaskItem.OwnerMask = srcTaskItem.OwnerMask; 1017 destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
1018 destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask;
1015 destTaskItem.Flags = srcTaskItem.Flags; 1019 destTaskItem.Flags = srcTaskItem.Flags;
1016 1020
1021 if(destPart.OwnerID != part.OwnerID)
1022 {
1023 if (ExternalChecks.ExternalChecksPropagatePermissions())
1024 {
1025 destTaskItem.OwnerMask = srcTaskItem.OwnerMask &
1026 srcTaskItem.NextOwnerMask;
1027 destTaskItem.GroupMask = srcTaskItem.GroupMask &
1028 srcTaskItem.NextOwnerMask;
1029 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask &
1030 srcTaskItem.NextOwnerMask;
1031 destTaskItem.BaseMask = srcTaskItem.BaseMask &
1032 srcTaskItem.NextOwnerMask;
1033 destTaskItem.OwnerMask |= 8; // Slam!
1034 }
1035 }
1036
1017 destTaskItem.Description = srcTaskItem.Description; 1037 destTaskItem.Description = srcTaskItem.Description;
1018 destTaskItem.Name = srcTaskItem.Name; 1038 destTaskItem.Name = srcTaskItem.Name;
1019 destTaskItem.InvType = srcTaskItem.InvType; 1039 destTaskItem.InvType = srcTaskItem.InvType;
1020 destTaskItem.Type = srcTaskItem.Type; 1040 destTaskItem.Type = srcTaskItem.Type;
1021 1041
1022 destPart.AddInventoryItem(destTaskItem); 1042 destPart.AddInventoryItem(destTaskItem);
1043
1044 if((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0)
1045 part.RemoveInventoryItem(itemId);
1023 1046
1024 } 1047 }
1025 1048
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 69981e2..bbef28f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2010,7 +2010,7 @@ namespace OpenSim.Region.Environment.Scenes
2010 client.OnRequestTaskInventory += RequestTaskInventory; 2010 client.OnRequestTaskInventory += RequestTaskInventory;
2011 client.OnRemoveTaskItem += RemoveTaskInventory; 2011 client.OnRemoveTaskItem += RemoveTaskInventory;
2012 client.OnUpdateTaskInventory += UpdateTaskInventory; 2012 client.OnUpdateTaskInventory += UpdateTaskInventory;
2013 client.OnMoveTaskItem += MoveTaskInventoryItem; 2013 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2014 client.OnGrabObject += ProcessObjectGrab; 2014 client.OnGrabObject += ProcessObjectGrab;
2015 client.OnDeGrabObject += ProcessObjectDeGrab; 2015 client.OnDeGrabObject += ProcessObjectDeGrab;
2016 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2016 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
@@ -3628,4 +3628,4 @@ namespace OpenSim.Region.Environment.Scenes
3628 } 3628 }
3629} 3629}
3630 3630
3631 \ No newline at end of file 3631
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index a4e473d..6d40dff 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -2729,7 +2729,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2729 else 2729 else
2730 { 2730 {
2731 // destination is an object 2731 // destination is an object
2732 World.CopyTaskInventoryItem(destId, m_host, objId); 2732 World.MoveTaskInventoryItem(destId, m_host, objId);
2733 } 2733 }
2734 2734
2735 if (!found) 2735 if (!found)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7832633..7c6bcf7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -36,6 +36,7 @@ using Axiom.Math;
36using libsecondlife; 36using libsecondlife;
37using OpenSim; 37using OpenSim;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache;
39using OpenSim.Region.Environment; 40using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Interfaces; 41using OpenSim.Region.Environment.Interfaces;
41using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 42using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
@@ -2549,7 +2550,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2549 public void llGiveInventory(string destination, string inventory) 2550 public void llGiveInventory(string destination, string inventory)
2550 { 2551 {
2551 m_host.AddScriptLPS(1); 2552 m_host.AddScriptLPS(1);
2552 NotImplemented("llGiveInventory"); 2553 bool found = false;
2554 LLUUID destId = LLUUID.Zero;
2555 LLUUID objId = LLUUID.Zero;
2556
2557 if(!LLUUID.TryParse(destination, out destId))
2558 {
2559 llSay(0, "Could not parse key " + destination);
2560 return;
2561 }
2562
2563 // move the first object found with this inventory name
2564 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
2565 {
2566 if (inv.Value.Name == inventory)
2567 {
2568 found = true;
2569 objId = inv.Key;
2570 break;
2571 }
2572 }
2573
2574 // check if destination is an avatar
2575 if (World.GetScenePresence(destId) != null)
2576 {
2577 // destination is an avatar
2578 CachedUserInfo userInfo =
2579 World.CommsManager.UserProfileCacheService.GetUserDetails(destId);
2580 World.MoveTaskInventoryItem(destId,userInfo.RootFolder.ID, m_host, objId);
2581 }
2582 else
2583 {
2584 // destination is an object
2585 World.MoveTaskInventoryItem(destId, m_host, objId);
2586 }
2587
2588 if (!found)
2589 llSay(0, "Could not find object " + inventory);
2553 } 2590 }
2554 2591
2555 public void llRemoveInventory(string item) 2592 public void llRemoveInventory(string item)