diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 68 |
1 files changed, 63 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 8250e6c..58e157c 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 | ||
@@ -116,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests | |||
116 | { | 113 | { |
117 | TestHelpers.InMethod(); | 114 | TestHelpers.InMethod(); |
118 | // TestHelpers.EnableLogging(); | 115 | // TestHelpers.EnableLogging(); |
119 | 116 | ||
120 | Scene scene = new SceneHelpers().SetupScene(); | 117 | Scene scene = new SceneHelpers().SetupScene(); |
121 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 118 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
122 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 119 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
@@ -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, UUID.Zero, 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 |