diff options
author | Oren Hurvitz | 2013-11-05 15:42:23 +0200 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-10 19:50:03 +0000 |
commit | 91fd9c467083a57e2898594ce3ae764aa0525bb5 (patch) | |
tree | 32078bfcfec717530d29f18d8b2afb6b41cfbab3 /OpenSim/Region/CoreModules | |
parent | Refactored setting permissions when rezzing items: use the same function when... (diff) | |
download | opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.zip opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.gz opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.bz2 opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.xz |
Refactored: use a single function to apply an object's folded permissions to its main permissions
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | 8 |
2 files changed, 10 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index da36ed0..a7e6fdd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -443,13 +443,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
443 | } | 443 | } |
444 | else | 444 | else |
445 | { | 445 | { |
446 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
447 | |||
448 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 446 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
449 | item.Description = asset.Description; | 447 | item.Description = asset.Description; |
450 | item.Name = asset.Name; | 448 | item.Name = asset.Name; |
451 | item.AssetType = asset.Type; | 449 | item.AssetType = asset.Type; |
452 | 450 | ||
451 | AddPermissions(item, objlist[0], objlist, remoteClient); | ||
452 | |||
453 | m_Scene.AddInventoryItem(item); | 453 | m_Scene.AddInventoryItem(item); |
454 | 454 | ||
455 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 455 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
@@ -495,16 +495,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
495 | effectivePerms &= grp.GetEffectivePermissions(); | 495 | effectivePerms &= grp.GetEffectivePermissions(); |
496 | effectivePerms |= (uint)PermissionMask.Move; | 496 | effectivePerms |= (uint)PermissionMask.Move; |
497 | 497 | ||
498 | //PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
499 | |||
498 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 500 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
499 | { | 501 | { |
500 | uint perms = effectivePerms; | 502 | uint perms = effectivePerms; |
501 | uint nextPerms = (perms & 7) << 13; | 503 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
502 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
503 | perms &= ~(uint)PermissionMask.Copy; | ||
504 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
505 | perms &= ~(uint)PermissionMask.Transfer; | ||
506 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
507 | perms &= ~(uint)PermissionMask.Modify; | ||
508 | 504 | ||
509 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 505 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; |
510 | item.CurrentPermissions = item.BasePermissions; | 506 | item.CurrentPermissions = item.BasePermissions; |
@@ -530,8 +526,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
530 | (uint)PermissionMask.Move | | 526 | (uint)PermissionMask.Move | |
531 | (uint)PermissionMask.Export | | 527 | (uint)PermissionMask.Export | |
532 | 7); // Preserve folded permissions | 528 | 7); // Preserve folded permissions |
533 | } | 529 | } |
534 | 530 | ||
531 | //PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions); | ||
532 | |||
535 | return item; | 533 | return item; |
536 | } | 534 | } |
537 | 535 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 22a53a8..0cb574a 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -198,13 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
198 | item.InvType = (int)InventoryType.Object; | 198 | item.InvType = (int)InventoryType.Object; |
199 | item.Folder = categoryID; | 199 | item.Folder = categoryID; |
200 | 200 | ||
201 | uint nextPerms=(perms & 7) << 13; | 201 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); |
202 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
203 | perms &= ~(uint)PermissionMask.Copy; | ||
204 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
205 | perms &= ~(uint)PermissionMask.Transfer; | ||
206 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
207 | perms &= ~(uint)PermissionMask.Modify; | ||
208 | 202 | ||
209 | item.BasePermissions = perms & part.NextOwnerMask; | 203 | item.BasePermissions = perms & part.NextOwnerMask; |
210 | item.CurrentPermissions = perms & part.NextOwnerMask; | 204 | item.CurrentPermissions = perms & part.NextOwnerMask; |