aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs66
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs4
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;
38using OpenMetaverse.Assets; 38using OpenMetaverse.Assets;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.CoreModules.Framework.InventoryAccess;
42using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
43using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 43using 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