diff options
author | Melanie Thielker | 2008-11-14 17:24:56 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-14 17:24:56 +0000 |
commit | edee11ff8750d452f012690c556384984795f4be (patch) | |
tree | 21738d6ee71f00dea792585ab25557c64e571dca /OpenSim/Region/Environment | |
parent | * Switch default permissions back to false (so they are not on) as they were ... (diff) | |
download | opensim-SC-edee11ff8750d452f012690c556384984795f4be.zip opensim-SC-edee11ff8750d452f012690c556384984795f4be.tar.gz opensim-SC-edee11ff8750d452f012690c556384984795f4be.tar.bz2 opensim-SC-edee11ff8750d452f012690c556384984795f4be.tar.xz |
Reapplying a revised version of Christopher Yeoh's (IBM) patch for allow
inventory drop. Also adds a new flags, "propagate_permissions" to
OpenSim.ini to control that feature.
Diffstat (limited to 'OpenSim/Region/Environment')
4 files changed, 60 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 28e9850..7f567e5 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
64 | // Bypasses the permissions engine | 64 | // Bypasses the permissions engine |
65 | private bool m_bypassPermissions = true; | 65 | private bool m_bypassPermissions = true; |
66 | private bool m_bypassPermissionsValue = true; | 66 | private bool m_bypassPermissionsValue = true; |
67 | private bool m_propagatePermissions = false; | ||
67 | private bool m_debugPermissions = false; | 68 | private bool m_debugPermissions = false; |
68 | private bool m_allowGridGods = false; | 69 | private bool m_allowGridGods = false; |
69 | private bool m_RegionOwnerIsGod = false; | 70 | private bool m_RegionOwnerIsGod = false; |
@@ -143,6 +144,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
143 | 144 | ||
144 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); | 145 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); |
145 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); | 146 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); |
147 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); | ||
146 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); | 148 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); |
147 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); | 149 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); |
148 | 150 | ||
@@ -278,7 +280,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
278 | 280 | ||
279 | public bool PropagatePermissions() | 281 | public bool PropagatePermissions() |
280 | { | 282 | { |
281 | return false; | 283 | if (m_bypassPermissions) |
284 | return false; | ||
285 | |||
286 | return m_propagatePermissions; | ||
282 | } | 287 | } |
283 | 288 | ||
284 | public bool BypassPermissions() | 289 | public bool BypassPermissions() |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 687a225..2c0c872 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1179,7 +1179,7 @@ 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 | 1183 | ||
1184 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1184 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1185 | part.RemoveInventoryItem(itemId); | 1185 | part.RemoveInventoryItem(itemId); |
@@ -1249,10 +1249,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1249 | 1249 | ||
1250 | if (part != null) | 1250 | if (part != null) |
1251 | { | 1251 | { |
1252 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1253 | return; | ||
1254 | |||
1255 | TaskInventoryItem currentItem = part.GetInventoryItem(itemID); | 1252 | TaskInventoryItem currentItem = part.GetInventoryItem(itemID); |
1253 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() | ||
1254 | & (uint)PrimFlags.AllowInventoryDrop) != 0; | ||
1255 | |||
1256 | // Explicity allow anyone to add to the inventory if the | ||
1257 | // AllowInventoryDrop flag has been set. Don't however let | ||
1258 | // them update an item unless they pass the external checks | ||
1259 | // | ||
1260 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId) | ||
1261 | && (currentItem != null || !allowInventoryDrop )) | ||
1262 | return; | ||
1256 | 1263 | ||
1257 | if (currentItem == null) | 1264 | if (currentItem == null) |
1258 | { | 1265 | { |
@@ -1417,7 +1424,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1417 | taskItem.PermsMask = 0; | 1424 | taskItem.PermsMask = 0; |
1418 | taskItem.AssetID = asset.FullID; | 1425 | taskItem.AssetID = asset.FullID; |
1419 | 1426 | ||
1420 | part.AddInventoryItem(taskItem); | 1427 | part.AddInventoryItem(taskItem, false); |
1421 | part.GetProperties(remoteClient); | 1428 | part.GetProperties(remoteClient); |
1422 | 1429 | ||
1423 | part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1430 | part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
@@ -1512,7 +1519,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1512 | destTaskItem.InvType = srcTaskItem.InvType; | 1519 | destTaskItem.InvType = srcTaskItem.InvType; |
1513 | destTaskItem.Type = srcTaskItem.Type; | 1520 | destTaskItem.Type = srcTaskItem.Type; |
1514 | 1521 | ||
1515 | destPart.AddInventoryItemExclusive(destTaskItem); | 1522 | destPart.AddInventoryItemExclusive(destTaskItem, false); |
1516 | 1523 | ||
1517 | if (running > 0) | 1524 | if (running > 0) |
1518 | { | 1525 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index bfa9763..2b560f4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -151,23 +151,44 @@ 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 && |
160 | taskItem.CurrentPermissions = item.CurrentPermissions; | 160 | remoteClient.AgentId != part.OwnerID && |
161 | // FIXME: ignoring group permissions for now as they aren't stored in item | 161 | m_scene.ExternalChecks.ExternalChecksPropagatePermissions()) |
162 | taskItem.EveryonePermissions = item.EveryOnePermissions; | 162 | { |
163 | taskItem.NextPermissions = item.NextPermissions; | 163 | taskItem.BasePermissions = item.BasePermissions & |
164 | item.NextPermissions; | ||
165 | taskItem.CurrentPermissions = item.CurrentPermissions & | ||
166 | item.NextPermissions; | ||
167 | taskItem.EveryonePermissions = item.EveryOnePermissions & | ||
168 | item.NextPermissions; | ||
169 | taskItem.NextPermissions = item.NextPermissions; | ||
170 | taskItem.CurrentPermissions |= 8; | ||
171 | } else { | ||
172 | taskItem.BasePermissions = item.BasePermissions; | ||
173 | taskItem.CurrentPermissions = item.CurrentPermissions; | ||
174 | taskItem.CurrentPermissions |= 8; | ||
175 | taskItem.EveryonePermissions = item.EveryOnePermissions; | ||
176 | taskItem.NextPermissions = item.NextPermissions; | ||
177 | } | ||
178 | |||
164 | taskItem.Flags = item.Flags; | 179 | taskItem.Flags = item.Flags; |
165 | // TODO: These are pending addition of those fields to TaskInventoryItem | 180 | // TODO: These are pending addition of those fields to TaskInventoryItem |
166 | // taskItem.SalePrice = item.SalePrice; | 181 | // taskItem.SalePrice = item.SalePrice; |
167 | // taskItem.SaleType = item.SaleType; | 182 | // taskItem.SaleType = item.SaleType; |
168 | taskItem.CreationDate = (uint)item.CreationDate; | 183 | taskItem.CreationDate = (uint)item.CreationDate; |
184 | |||
185 | bool addFromAllowedDrop = false; | ||
186 | if (remoteClient!=null) | ||
187 | { | ||
188 | addFromAllowedDrop = remoteClient.AgentId!=part.OwnerID; | ||
189 | } | ||
169 | 190 | ||
170 | part.AddInventoryItem(taskItem); | 191 | part.AddInventoryItem(taskItem, addFromAllowedDrop); |
171 | 192 | ||
172 | return true; | 193 | return true; |
173 | } | 194 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 501f199..073bccf 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,11 @@ 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 | |
344 | if (allowedDrop) | ||
345 | TriggerScriptChangedEvent(Changed.ALLOWED_DROP); | ||
346 | else | ||
347 | TriggerScriptChangedEvent(Changed.INVENTORY); | ||
341 | } | 348 | } |
342 | 349 | ||
343 | m_inventorySerial++; | 350 | m_inventorySerial++; |