diff options
author | Diva Canto | 2016-06-24 12:27:45 -0700 |
---|---|---|
committer | Diva Canto | 2016-06-24 12:27:45 -0700 |
commit | c34fcae3f32c7154ab93b4974991c959d4ad3955 (patch) | |
tree | 2aa7d141cd264a776f0a8c25d62be450212de274 | |
parent | Mantis #7933: copy-paste bug in avn code. (diff) | |
download | opensim-SC_OLD-c34fcae3f32c7154ab93b4974991c959d4ad3955.zip opensim-SC_OLD-c34fcae3f32c7154ab93b4974991c959d4ad3955.tar.gz opensim-SC_OLD-c34fcae3f32c7154ab93b4974991c959d4ad3955.tar.bz2 opensim-SC_OLD-c34fcae3f32c7154ab93b4974991c959d4ad3955.tar.xz |
Added a test for checking permissions in inventory items that are transferred. This is a work in progress. All permission assertions are commented for now. Will get back to this later when permissions are fixed by Melanie.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 66 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 4 |
2 files changed, 66 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 8250e6c..75b073d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -38,10 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenMetaverse.Assets; | 38 | using OpenMetaverse.Assets; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; |
42 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
45 | using OpenSim.Services.Interfaces; | 42 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 43 | using OpenSim.Tests.Common; |
47 | 44 | ||
@@ -138,5 +135,66 @@ namespace OpenSim.Region.Framework.Tests | |||
138 | 135 | ||
139 | Assert.That(reretrievedFolders.Count, Is.EqualTo(2)); | 136 | Assert.That(reretrievedFolders.Count, Is.EqualTo(2)); |
140 | } | 137 | } |
138 | |||
139 | // Work in Progress test. All Assertions pertaining permissions are commented for now. | ||
140 | [Test] | ||
141 | public void TestGiveInventoryItemFullPerms() | ||
142 | { | ||
143 | TestHelpers.InMethod(); | ||
144 | |||
145 | List<Object> modules = new List<object>(); | ||
146 | IConfigSource config = DefaultConfig(modules); | ||
147 | Scene scene = new SceneHelpers().SetupScene("Inventory Permissions", UUID.Random(), 1000, 1000, config); | ||
148 | SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); | ||
149 | |||
150 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | ||
151 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | ||
152 | ScenePresence sp1 = SceneHelpers.AddScenePresence(scene, user1.PrincipalID); | ||
153 | ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, user2.PrincipalID); | ||
154 | |||
155 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "SomeObject", user1.PrincipalID, InventoryType.Object); | ||
156 | // Set All perms in inventory | ||
157 | item1.NextPermissions = (uint)OpenMetaverse.PermissionMask.All; | ||
158 | scene.UpdateInventoryItemAsset(sp1.ControllingClient, UUID.Zero, item1.ID, item1); | ||
159 | //Assert.That((item1.NextPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); | ||
160 | |||
161 | string message; | ||
162 | |||
163 | InventoryItemBase retrievedItem1 = scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message); | ||
164 | Assert.That(retrievedItem1, Is.Not.Null); | ||
165 | //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); | ||
166 | |||
167 | retrievedItem1 | ||
168 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Objects/SomeObject"); | ||
169 | Assert.That(retrievedItem1, Is.Not.Null); | ||
170 | //Assert.That((retrievedItem1.BasePermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); | ||
171 | //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); | ||
172 | |||
173 | // Rez the object | ||
174 | scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); | ||
175 | SceneObjectGroup sog = scene.GetSceneObjectGroup("SomeObject"); | ||
176 | Assert.That(sog, Is.Not.Null); | ||
177 | |||
178 | // This is failing for all sorts of reasons. We'll fix it after perms are fixed. | ||
179 | //Console.WriteLine("Item Perms " + retrievedItem1.CurrentPermissions + " Obj Owner Perms " + sog.RootPart.OwnerMask + " Base Perms " + sog.RootPart.BaseMask + "\n"); | ||
180 | //Assert.True((sog.RootPart.OwnerMask & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); | ||
181 | |||
182 | } | ||
183 | |||
184 | public static IConfigSource DefaultConfig(List<object> modules) | ||
185 | { | ||
186 | IConfigSource config = new IniConfigSource(); | ||
187 | config.AddConfig("Modules"); | ||
188 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
189 | |||
190 | config.AddConfig("Permissions"); | ||
191 | config.Configs["Permissions"].Set("permissionmodules", "DefaultPermissionsModule"); | ||
192 | config.Configs["Permissions"].Set("serverside_object_permissions", true); | ||
193 | config.Configs["Permissions"].Set("propagate_permissions", true); | ||
194 | |||
195 | modules.Add(new BasicInventoryAccessModule()); | ||
196 | return config; | ||
197 | } | ||
198 | |||
141 | } | 199 | } |
142 | } \ No newline at end of file | 200 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 5a36332..e7e145a 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -128,6 +128,10 @@ namespace OpenSim.Tests.Common | |||
128 | item.Owner = userId; | 128 | item.Owner = userId; |
129 | item.AssetType = asset.Type; | 129 | item.AssetType = asset.Type; |
130 | item.InvType = (int)itemType; | 130 | item.InvType = (int)itemType; |
131 | item.BasePermissions = (uint)OpenMetaverse.PermissionMask.All | | ||
132 | (uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer); | ||
133 | item.CurrentPermissions = (uint)OpenMetaverse.PermissionMask.All | | ||
134 | (uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer); | ||
131 | 135 | ||
132 | InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0]; | 136 | InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0]; |
133 | 137 | ||