diff options
author | Melanie | 2013-04-28 19:03:39 +0200 |
---|---|---|
committer | Melanie | 2013-04-28 19:03:39 +0200 |
commit | 4275d7a839d7380ee50aeadc38a31dd467bd891e (patch) | |
tree | 1e589fc3b448b580d1cc25b52215ef5ce2d7ae78 /OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | Controller module for dynamic floaters (WIP) (diff) | |
download | opensim-SC-4275d7a839d7380ee50aeadc38a31dd467bd891e.zip opensim-SC-4275d7a839d7380ee50aeadc38a31dd467bd891e.tar.gz opensim-SC-4275d7a839d7380ee50aeadc38a31dd467bd891e.tar.bz2 opensim-SC-4275d7a839d7380ee50aeadc38a31dd467bd891e.tar.xz |
Merge branch 'avination-current' of ssh://3dhosting.de/var/git/careminster into avination-current
Conflicts:
bin/Regions/Regions.ini.example
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 102 |
1 files changed, 81 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c9d1205..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; | |||
39 | using OpenSim.Framework.Client; | 39 | using OpenSim.Framework.Client; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes.Serialization; | 41 | using OpenSim.Region.Framework.Scenes.Serialization; |
42 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.Framework.Scenes | 44 | namespace OpenSim.Region.Framework.Scenes |
44 | { | 45 | { |
@@ -401,29 +402,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
401 | if (item.Owner != remoteClient.AgentId) | 402 | if (item.Owner != remoteClient.AgentId) |
402 | return; | 403 | return; |
403 | 404 | ||
404 | if (UUID.Zero == transactionID) | 405 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); |
405 | { | 406 | item.Name = itemUpd.Name; |
406 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | 407 | item.Description = itemUpd.Description; |
407 | item.Name = itemUpd.Name; | ||
408 | item.Description = itemUpd.Description; | ||
409 | 408 | ||
410 | // m_log.DebugFormat( | 409 | // m_log.DebugFormat( |
411 | // "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}", | 410 | // "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}", |
412 | // itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags, | 411 | // itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags, |
413 | // item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions); | 412 | // item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions); |
414 | 413 | ||
414 | if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid | ||
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,8 +485,10 @@ 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 | else | 490 | |
491 | if (UUID.Zero != transactionID) | ||
450 | { | 492 | { |
451 | if (AgentTransactionsModule != null) | 493 | if (AgentTransactionsModule != null) |
452 | { | 494 | { |
@@ -683,12 +725,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
683 | itemCopy.SalePrice = item.SalePrice; | 725 | itemCopy.SalePrice = item.SalePrice; |
684 | itemCopy.SaleType = item.SaleType; | 726 | itemCopy.SaleType = item.SaleType; |
685 | 727 | ||
686 | if (AddInventoryItem(itemCopy)) | 728 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
687 | { | 729 | if (invAccess != null) |
688 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 730 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); |
689 | if (invAccess != null) | 731 | AddInventoryItem(itemCopy); |
690 | Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); }); | ||
691 | } | ||
692 | 732 | ||
693 | if (!Permissions.BypassPermissions()) | 733 | if (!Permissions.BypassPermissions()) |
694 | { | 734 | { |
@@ -908,7 +948,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
908 | { | 948 | { |
909 | CreateNewInventoryItem( | 949 | CreateNewInventoryItem( |
910 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 950 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
911 | (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); |
912 | } | 952 | } |
913 | 953 | ||
914 | 954 | ||
@@ -1037,8 +1077,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1037 | CreateNewInventoryItem( | 1077 | CreateNewInventoryItem( |
1038 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 1078 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
1039 | name, description, 0, callbackID, asset, invType, | 1079 | name, description, 0, callbackID, asset, invType, |
1040 | (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, |
1041 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); | 1081 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); |
1042 | } | 1082 | } |
1043 | else | 1083 | else |
1044 | { | 1084 | { |
@@ -1785,6 +1825,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1785 | /// <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> |
1786 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) | 1826 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) |
1787 | { | 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 | { | ||
1788 | // The part ID is the folder ID! | 1843 | // The part ID is the folder ID! |
1789 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); | 1844 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); |
1790 | if (part == null) | 1845 | if (part == null) |
@@ -1804,9 +1859,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1804 | return null; | 1859 | return null; |
1805 | } | 1860 | } |
1806 | 1861 | ||
1807 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1862 | AssetBase asset |
1808 | 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( |
1809 | agentID); | 1864 | itemBase.Name, |
1865 | itemBase.Description, | ||
1866 | (sbyte)itemBase.AssetType, | ||
1867 | Encoding.ASCII.GetBytes(scriptText), | ||
1868 | agentID); | ||
1869 | |||
1810 | AssetService.Store(asset); | 1870 | AssetService.Store(asset); |
1811 | 1871 | ||
1812 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1872 | TaskInventoryItem taskItem = new TaskInventoryItem(); |