aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDr Scofield2008-11-14 10:55:14 +0000
committerDr Scofield2008-11-14 10:55:14 +0000
commit5e20e32b6993a79f8f31cb12882b9c4499140275 (patch)
tree8620c9dbaec8e4c973334511f5d3ebc98389a3d8 /OpenSim/Region
parentFrom: Alan Webb (alan_webb@us.ibm.com) (diff)
downloadopensim-SC_OLD-5e20e32b6993a79f8f31cb12882b9c4499140275.zip
opensim-SC_OLD-5e20e32b6993a79f8f31cb12882b9c4499140275.tar.gz
opensim-SC_OLD-5e20e32b6993a79f8f31cb12882b9c4499140275.tar.bz2
opensim-SC_OLD-5e20e32b6993a79f8f31cb12882b9c4499140275.tar.xz
From: Christopher Yeoh <cyeoh@au1.ibm.com>
This patch makes llAllowInventoryDrop work with the permissions module enabled. Changes include: - Enabled PropagatePermissions when permissions module serverside perms is on - change ownership of item when item is dropped into an object. Ownership changes to the owner of the object the item is dropped into - propagation of permissions if the permissions module enabled (eg next-owner mask applied) - CHANGED_ALLOWED_DROP is now passed to the change script event if an item was allowed to be dropped into the object only because llAllowInventoryDrop is enabled (instead of CHANGED_INVENTORY being passed). - Sets object flags correctly when llAllowInventoryDrop is called so clients are notified immediately of the change in state. Am not sure that calling aggregateScriptEvents is the right way to do it, but it works and seems to be the only way without making further changes to update LocalFlags
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs35
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
6 files changed, 56 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 87348fc..c5a9066 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -277,7 +277,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
277 277
278 public bool PropagatePermissions() 278 public bool PropagatePermissions()
279 { 279 {
280 return false; 280 return !m_bypassPermissions;
281 } 281 }
282 282
283 public bool BypassPermissions() 283 public bool BypassPermissions()
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 12095e5..590bea0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1179,7 +1179,8 @@ namespace OpenSim.Region.Environment.Scenes
1179 destTaskItem.InvType = srcTaskItem.InvType; 1179 destTaskItem.InvType = srcTaskItem.InvType;
1180 destTaskItem.Type = srcTaskItem.Type; 1180 destTaskItem.Type = srcTaskItem.Type;
1181 1181
1182 destPart.AddInventoryItem(destTaskItem); 1182 destPart.AddInventoryItem(destTaskItem, part.OwnerID!=destPart.OwnerID
1183 && ExternalChecks.ExternalChecksPropagatePermissions());
1183 1184
1184 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1185 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1185 part.RemoveInventoryItem(itemId); 1186 part.RemoveInventoryItem(itemId);
@@ -1249,10 +1250,15 @@ namespace OpenSim.Region.Environment.Scenes
1249 1250
1250 if (part != null) 1251 if (part != null)
1251 { 1252 {
1252 if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
1253 return;
1254
1255 TaskInventoryItem currentItem = part.GetInventoryItem(itemID); 1253 TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
1254 bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
1255 & (uint)PrimFlags.AllowInventoryDrop) != 0;
1256 // Explicity allow anyone to add to the inventory if the AllowInventoryDrop
1257 // flag has been set. Don't however let them update an item unless
1258 // they pass the external checks
1259 if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)
1260 && (currentItem != null || !allowInventoryDrop ))
1261 return;
1256 1262
1257 if (currentItem == null) 1263 if (currentItem == null)
1258 { 1264 {
@@ -1417,7 +1423,7 @@ namespace OpenSim.Region.Environment.Scenes
1417 taskItem.PermsMask = 0; 1423 taskItem.PermsMask = 0;
1418 taskItem.AssetID = asset.FullID; 1424 taskItem.AssetID = asset.FullID;
1419 1425
1420 part.AddInventoryItem(taskItem); 1426 part.AddInventoryItem(taskItem, false);
1421 part.GetProperties(remoteClient); 1427 part.GetProperties(remoteClient);
1422 1428
1423 part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1429 part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
@@ -1512,7 +1518,7 @@ namespace OpenSim.Region.Environment.Scenes
1512 destTaskItem.InvType = srcTaskItem.InvType; 1518 destTaskItem.InvType = srcTaskItem.InvType;
1513 destTaskItem.Type = srcTaskItem.Type; 1519 destTaskItem.Type = srcTaskItem.Type;
1514 1520
1515 destPart.AddInventoryItemExclusive(destTaskItem); 1521 destPart.AddInventoryItemExclusive(destTaskItem, false);
1516 1522
1517 if (running > 0) 1523 if (running > 0)
1518 { 1524 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index bfa9763..8275ceb 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -151,23 +151,42 @@ namespace OpenSim.Region.Environment.Scenes
151 taskItem.AssetID = item.AssetID; 151 taskItem.AssetID = item.AssetID;
152 taskItem.Name = item.Name; 152 taskItem.Name = item.Name;
153 taskItem.Description = item.Description; 153 taskItem.Description = item.Description;
154 taskItem.OwnerID = item.Owner; 154 taskItem.OwnerID = part.OwnerID; // Transfer ownership
155 taskItem.CreatorID = item.Creator; 155 taskItem.CreatorID = item.Creator;
156 taskItem.Type = item.AssetType; 156 taskItem.Type = item.AssetType;
157 taskItem.InvType = item.InvType; 157 taskItem.InvType = item.InvType;
158 158
159 taskItem.BasePermissions = item.BasePermissions; 159 if (remoteClient!=null && remoteClient.AgentId!=part.OwnerID &&
160 taskItem.CurrentPermissions = item.CurrentPermissions; 160 m_scene.ExternalChecks.ExternalChecksPropagatePermissions()) {
161 // FIXME: ignoring group permissions for now as they aren't stored in item 161 taskItem.BasePermissions = item.BasePermissions & item.NextPermissions;
162 taskItem.EveryonePermissions = item.EveryOnePermissions; 162 taskItem.CurrentPermissions = item.CurrentPermissions & item.NextPermissions;
163 taskItem.NextPermissions = item.NextPermissions; 163 taskItem.EveryonePermissions = item.EveryOnePermissions & item.NextPermissions;
164 taskItem.NextPermissions = item.NextPermissions;
165 taskItem.CurrentPermissions |= 8;
166 } else {
167 taskItem.BasePermissions = item.BasePermissions;
168 taskItem.CurrentPermissions = item.CurrentPermissions;
169 taskItem.CurrentPermissions |= 8;
170 taskItem.EveryonePermissions = item.EveryOnePermissions;
171 taskItem.NextPermissions = item.NextPermissions;
172 }
173
174
175
164 taskItem.Flags = item.Flags; 176 taskItem.Flags = item.Flags;
165 // TODO: These are pending addition of those fields to TaskInventoryItem 177 // TODO: These are pending addition of those fields to TaskInventoryItem
166// taskItem.SalePrice = item.SalePrice; 178// taskItem.SalePrice = item.SalePrice;
167// taskItem.SaleType = item.SaleType; 179// taskItem.SaleType = item.SaleType;
168 taskItem.CreationDate = (uint)item.CreationDate; 180 taskItem.CreationDate = (uint)item.CreationDate;
169 181
170 part.AddInventoryItem(taskItem); 182 bool addFromAllowedDrop = false;
183 if (remoteClient!=null)
184 {
185 addFromAllowedDrop = remoteClient.AgentId!=part.OwnerID &&
186 m_scene.ExternalChecks.ExternalChecksPropagatePermissions();
187 }
188
189 part.AddInventoryItem(taskItem, addFromAllowedDrop);
171 190
172 return true; 191 return true;
173 } 192 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 501f199..fa66515 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -289,16 +289,16 @@ namespace OpenSim.Region.Environment.Scenes
289 /// name is chosen. 289 /// name is chosen.
290 /// </summary> 290 /// </summary>
291 /// <param name="item"></param> 291 /// <param name="item"></param>
292 public void AddInventoryItem(TaskInventoryItem item) 292 public void AddInventoryItem(TaskInventoryItem item, bool allowedDrop)
293 { 293 {
294 AddInventoryItem(item.Name, item); 294 AddInventoryItem(item.Name, item, allowedDrop);
295 } 295 }
296 296
297 /// <summary> 297 /// <summary>
298 /// Add an item to this prim's inventory. If an item with the same name already exists, it is replaced. 298 /// Add an item to this prim's inventory. If an item with the same name already exists, it is replaced.
299 /// </summary> 299 /// </summary>
300 /// <param name="item"></param> 300 /// <param name="item"></param>
301 public void AddInventoryItemExclusive(TaskInventoryItem item) 301 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
302 { 302 {
303 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values); 303 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values);
304 foreach (TaskInventoryItem i in il) 304 foreach (TaskInventoryItem i in il)
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
313 } 313 }
314 } 314 }
315 315
316 AddInventoryItem(item.Name, item); 316 AddInventoryItem(item.Name, item, allowedDrop);
317 } 317 }
318 318
319 /// <summary> 319 /// <summary>
@@ -324,7 +324,10 @@ namespace OpenSim.Region.Environment.Scenes
324 /// The item itself. The name within this structure is ignored in favour of the name 324 /// The item itself. The name within this structure is ignored in favour of the name
325 /// given in this method's arguments 325 /// given in this method's arguments
326 /// </param> 326 /// </param>
327 protected void AddInventoryItem(string name, TaskInventoryItem item) 327 /// <param name="allowedDrop">
328 // Item was only added to inventory because AllowedDrop is set
329 /// </param>
330 protected void AddInventoryItem(string name, TaskInventoryItem item, bool allowedDrop)
328 { 331 {
329 name = FindAvailableInventoryName(name); 332 name = FindAvailableInventoryName(name);
330 if (name == String.Empty) 333 if (name == String.Empty)
@@ -337,7 +340,10 @@ namespace OpenSim.Region.Environment.Scenes
337 lock (m_taskInventory) 340 lock (m_taskInventory)
338 { 341 {
339 m_taskInventory.Add(item.ItemID, item); 342 m_taskInventory.Add(item.ItemID, item);
340 TriggerScriptChangedEvent(Changed.INVENTORY); 343 if (allowedDrop)
344 TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
345 else
346 TriggerScriptChangedEvent(Changed.INVENTORY);
341 } 347 }
342 348
343 m_inventorySerial++; 349 m_inventorySerial++;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ab7b710..c1d718e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4006,6 +4006,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4006 m_host.ParentGroup.RootPart.AllowedDrop = true; 4006 m_host.ParentGroup.RootPart.AllowedDrop = true;
4007 else 4007 else
4008 m_host.ParentGroup.RootPart.AllowedDrop = false; 4008 m_host.ParentGroup.RootPart.AllowedDrop = false;
4009
4010 // Update the object flags
4011 m_host.ParentGroup.RootPart.aggregateScriptEvents();
4009 } 4012 }
4010 4013
4011 public LSL_Vector llGetSunDirection() 4014 public LSL_Vector llGetSunDirection()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f9302e9..8cac070 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1014,7 +1014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1014 taskItem.PermsMask = 0; 1014 taskItem.PermsMask = 0;
1015 taskItem.AssetID = asset.FullID; 1015 taskItem.AssetID = asset.FullID;
1016 1016
1017 m_host.AddInventoryItem(taskItem); 1017 m_host.AddInventoryItem(taskItem, false);
1018 } 1018 }
1019 } 1019 }
1020} 1020}