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.cs89
1 files changed, 74 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4130029..d2e41f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -39,6 +39,7 @@ using OpenSim.Region.Framework;
39using OpenSim.Framework.Client; 39using OpenSim.Framework.Client;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes.Serialization; 41using OpenSim.Region.Framework.Scenes.Serialization;
42using PermissionMask = OpenSim.Framework.PermissionMask;
42 43
43namespace OpenSim.Region.Framework.Scenes 44namespace OpenSim.Region.Framework.Scenes
44{ 45{
@@ -412,18 +413,57 @@ namespace OpenSim.Region.Framework.Scenes
412 413
413 if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid 414 if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid
414 { 415 {
416 // Create a set of base permissions that will not include export if the user
417 // is not allowed to change the export flag.
418 bool denyExportChange = false;
419
420 m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
421
422 // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export
423 if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner)
424 denyExportChange = true;
425
426 m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange);
427
428 // If it is already set, force it set and also force full perm
429 // else prevent setting it. It can and should never be set unless
430 // set in base, so the condition above is valid
431 if (denyExportChange)
432 {
433 // If we are not allowed to change it, then force it to the
434 // original item's setting and if it was on, also force full perm
435 if ((item.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
436 {
437 itemUpd.NextPermissions = (uint)(PermissionMask.All);
438 itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export;
439 }
440 else
441 {
442 itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export;
443 }
444 }
445 else
446 {
447 // If the new state is exportable, force full perm
448 if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
449 {
450 m_log.InfoFormat("[XXX]: Force full perm");
451 itemUpd.NextPermissions = (uint)(PermissionMask.All);
452 }
453 }
454
415 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 455 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
416 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 456 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
417 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 457 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
458
418 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) 459 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
419 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; 460 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
420 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 461 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
462
421 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 463 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
422 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 464 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
423
424// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
425
426 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 465 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
466
427 item.GroupID = itemUpd.GroupID; 467 item.GroupID = itemUpd.GroupID;
428 item.GroupOwned = itemUpd.GroupOwned; 468 item.GroupOwned = itemUpd.GroupOwned;
429 item.CreationDate = itemUpd.CreationDate; 469 item.CreationDate = itemUpd.CreationDate;
@@ -445,6 +485,7 @@ namespace OpenSim.Region.Framework.Scenes
445 item.SaleType = itemUpd.SaleType; 485 item.SaleType = itemUpd.SaleType;
446 486
447 InventoryService.UpdateItem(item); 487 InventoryService.UpdateItem(item);
488 remoteClient.SendBulkUpdateInventory(item);
448 } 489 }
449 490
450 if (UUID.Zero != transactionID) 491 if (UUID.Zero != transactionID)
@@ -684,12 +725,10 @@ namespace OpenSim.Region.Framework.Scenes
684 itemCopy.SalePrice = item.SalePrice; 725 itemCopy.SalePrice = item.SalePrice;
685 itemCopy.SaleType = item.SaleType; 726 itemCopy.SaleType = item.SaleType;
686 727
687 if (AddInventoryItem(itemCopy)) 728 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
688 { 729 if (invAccess != null)
689 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 730 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
690 if (invAccess != null) 731 AddInventoryItem(itemCopy);
691 Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); });
692 }
693 732
694 if (!Permissions.BypassPermissions()) 733 if (!Permissions.BypassPermissions())
695 { 734 {
@@ -909,7 +948,7 @@ namespace OpenSim.Region.Framework.Scenes
909 { 948 {
910 CreateNewInventoryItem( 949 CreateNewInventoryItem(
911 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, 950 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
912 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate, transationID); 951 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID);
913 } 952 }
914 953
915 954
@@ -1038,8 +1077,8 @@ namespace OpenSim.Region.Framework.Scenes
1038 CreateNewInventoryItem( 1077 CreateNewInventoryItem(
1039 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, 1078 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
1040 name, description, 0, callbackID, asset, invType, 1079 name, description, 0, callbackID, asset, invType,
1041 (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, 1080 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All,
1042 (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); 1081 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch());
1043 } 1082 }
1044 else 1083 else
1045 { 1084 {
@@ -1786,6 +1825,21 @@ namespace OpenSim.Region.Framework.Scenes
1786 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> 1825 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1787 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) 1826 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
1788 { 1827 {
1828 return RezNewScript(
1829 agentID,
1830 itemBase,
1831 "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
1832 }
1833
1834 /// <summary>
1835 /// Rez a new script from nothing with given script text.
1836 /// </summary>
1837 /// <param name="remoteClient"></param>
1838 /// <param name="itemBase">Template item.</param>
1839 /// <param name="scriptText"></param>
1840 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1841 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase, string scriptText)
1842 {
1789 // The part ID is the folder ID! 1843 // The part ID is the folder ID!
1790 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); 1844 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
1791 if (part == null) 1845 if (part == null)
@@ -1805,9 +1859,14 @@ namespace OpenSim.Region.Framework.Scenes
1805 return null; 1859 return null;
1806 } 1860 }
1807 1861
1808 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1862 AssetBase asset
1809 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), 1863 = CreateAsset(
1810 agentID); 1864 itemBase.Name,
1865 itemBase.Description,
1866 (sbyte)itemBase.AssetType,
1867 Encoding.ASCII.GetBytes(scriptText),
1868 agentID);
1869
1811 AssetService.Store(asset); 1870 AssetService.Store(asset);
1812 1871
1813 TaskInventoryItem taskItem = new TaskInventoryItem(); 1872 TaskInventoryItem taskItem = new TaskInventoryItem();