diff options
author | Diva Canto | 2017-05-01 10:09:54 -0700 |
---|---|---|
committer | Diva Canto | 2017-05-01 10:09:54 -0700 |
commit | 8e88a9d7024f300d817be6ec84b19e4d82f38693 (patch) | |
tree | f4b584cc9f09f9ca60a3ec33c663de299970c365 | |
parent | Perms test framework: make a lot of things more generic. (diff) | |
parent | buysell: make sure we dont buy child parts, dont mess with absolute position ... (diff) | |
download | opensim-SC_OLD-8e88a9d7024f300d817be6ec84b19e4d82f38693.zip opensim-SC_OLD-8e88a9d7024f300d817be6ec84b19e4d82f38693.tar.gz opensim-SC_OLD-8e88a9d7024f300d817be6ec84b19e4d82f38693.tar.bz2 opensim-SC_OLD-8e88a9d7024f300d817be6ec84b19e4d82f38693.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
3 files changed, 28 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 916ddb0..f1885da 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -579,26 +579,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
579 | IClientAPI remoteClient) | 579 | IClientAPI remoteClient) |
580 | { | 580 | { |
581 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask); | 581 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask); |
582 | 582 | ||
583 | // For the porposes of inventory, an object is modify if the prims | ||
584 | // are modify. This allows renaming an object that contains no | ||
585 | // mod items. | ||
586 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 583 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
587 | { | 584 | { |
588 | uint groupPerms = grp.GetEffectivePermissions(true); | 585 | effectivePerms &= grp.CurrentAndFoldedNextPermissions(); |
589 | // if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
590 | // groupPerms |= (uint)PermissionMask.Modify; | ||
591 | |||
592 | effectivePerms &= groupPerms; | ||
593 | } | 586 | } |
594 | 587 | ||
595 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 588 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
596 | { | 589 | { |
590 | // apply parts inventory items next owner | ||
597 | PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms); | 591 | PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms); |
598 | 592 | // change to next owner | |
599 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; | 593 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; |
600 | 594 | // fix and update folded | |
601 | // rebuild folded perms since we don't have then on inworld objects | ||
602 | basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); | 595 | basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); |
603 | 596 | ||
604 | item.BasePermissions = basePerms; | 597 | item.BasePermissions = basePerms; |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 6854b53..a7a9d1d 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -118,6 +118,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
118 | return false; | 118 | return false; |
119 | 119 | ||
120 | SceneObjectGroup group = part.ParentGroup; | 120 | SceneObjectGroup group = part.ParentGroup; |
121 | if(group == null || group.IsDeleted || group.inTransit) | ||
122 | return false; | ||
123 | |||
124 | // make sure we are not buying a child part | ||
125 | part = group.RootPart; | ||
121 | 126 | ||
122 | switch (saleType) | 127 | switch (saleType) |
123 | { | 128 | { |
@@ -157,18 +162,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
157 | break; | 162 | break; |
158 | 163 | ||
159 | case 2: // Sell a copy | 164 | case 2: // Sell a copy |
160 | Vector3 inventoryStoredPosition = new Vector3( | ||
161 | Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6), | ||
162 | Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6), | ||
163 | group.AbsolutePosition.Z); | ||
164 | |||
165 | Vector3 originalPosition = group.AbsolutePosition; | ||
166 | |||
167 | group.AbsolutePosition = inventoryStoredPosition; | ||
168 | |||
169 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
170 | group.AbsolutePosition = originalPosition; | ||
171 | |||
172 | uint perms = group.EffectiveOwnerPerms; | 165 | uint perms = group.EffectiveOwnerPerms; |
173 | 166 | ||
174 | if ((perms & (uint)PermissionMask.Transfer) == 0) | 167 | if ((perms & (uint)PermissionMask.Transfer) == 0) |
@@ -185,6 +178,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
185 | return false; | 178 | return false; |
186 | } | 179 | } |
187 | 180 | ||
181 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
182 | |||
188 | AssetBase asset = m_scene.CreateAsset( | 183 | AssetBase asset = m_scene.CreateAsset( |
189 | group.GetPartName(localID), | 184 | group.GetPartName(localID), |
190 | group.GetPartDescription(localID), | 185 | group.GetPartDescription(localID), |
@@ -206,12 +201,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
206 | item.InvType = (int)InventoryType.Object; | 201 | item.InvType = (int)InventoryType.Object; |
207 | item.Folder = categoryID; | 202 | item.Folder = categoryID; |
208 | 203 | ||
209 | perms = group.GetEffectivePermissions(false); | 204 | perms = group.CurrentAndFoldedNextPermissions(); |
210 | 205 | // apply parts inventory next perms | |
211 | PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); | 206 | PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); |
212 | 207 | // change to next owner perms | |
213 | perms &= part.NextOwnerMask; | 208 | perms &= part.NextOwnerMask; |
214 | 209 | // update folded | |
215 | perms = PermissionsUtil.FixAndFoldPermissions(perms); | 210 | perms = PermissionsUtil.FixAndFoldPermissions(perms); |
216 | 211 | ||
217 | item.BasePermissions = perms; | 212 | item.BasePermissions = perms; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 42f47b5..36844a9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -338,6 +338,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
338 | uint rootEveryonePerms = RootPart.EveryoneMask; | 338 | uint rootEveryonePerms = RootPart.EveryoneMask; |
339 | uint everyone = rootEveryonePerms; | 339 | uint everyone = rootEveryonePerms; |
340 | 340 | ||
341 | // date is time of writing april 30th 2017 | ||
342 | bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994); | ||
341 | SceneObjectPart[] parts = m_parts.GetArray(); | 343 | SceneObjectPart[] parts = m_parts.GetArray(); |
342 | for (int i = 0; i < parts.Length; i++) | 344 | for (int i = 0; i < parts.Length; i++) |
343 | { | 345 | { |
@@ -345,7 +347,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | part.AggregateInnerPerms(); | 347 | part.AggregateInnerPerms(); |
346 | owner &= part.AggregatedInnerOwnerPerms; | 348 | owner &= part.AggregatedInnerOwnerPerms; |
347 | group &= part.AggregatedInnerGroupPerms; | 349 | group &= part.AggregatedInnerGroupPerms; |
348 | everyone &= part.AggregatedInnerEveryonePerms; | 350 | if(newObject) |
351 | everyone &= part.AggregatedInnerEveryonePerms; | ||
349 | } | 352 | } |
350 | // recover modify and move | 353 | // recover modify and move |
351 | rootOwnerPerms &= movemodmask; | 354 | rootOwnerPerms &= movemodmask; |
@@ -407,14 +410,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
407 | uint everyone = rootEveryonePerms; | 410 | uint everyone = rootEveryonePerms; |
408 | 411 | ||
409 | bool needUpdate = false; | 412 | bool needUpdate = false; |
410 | 413 | // date is time of writing april 30th 2017 | |
414 | bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994); | ||
411 | SceneObjectPart[] parts = m_parts.GetArray(); | 415 | SceneObjectPart[] parts = m_parts.GetArray(); |
412 | for (int i = 0; i < parts.Length; i++) | 416 | for (int i = 0; i < parts.Length; i++) |
413 | { | 417 | { |
414 | SceneObjectPart part = parts[i]; | 418 | SceneObjectPart part = parts[i]; |
415 | owner &= part.AggregatedInnerOwnerPerms; | 419 | owner &= part.AggregatedInnerOwnerPerms; |
416 | group &= part.AggregatedInnerGroupPerms; | 420 | group &= part.AggregatedInnerGroupPerms; |
417 | everyone &= part.AggregatedInnerEveryonePerms; | 421 | if(newObject) |
422 | everyone &= part.AggregatedInnerEveryonePerms; | ||
418 | } | 423 | } |
419 | // recover modify and move | 424 | // recover modify and move |
420 | rootOwnerPerms &= movemodmask; | 425 | rootOwnerPerms &= movemodmask; |
@@ -479,7 +484,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
479 | } | 484 | } |
480 | } | 485 | } |
481 | 486 | ||
482 | public uint GetEffectivePermissions(bool useBase) | 487 | public uint CurrentAndFoldedNextPermissions() |
483 | { | 488 | { |
484 | uint perms=(uint)(PermissionMask.Modify | | 489 | uint perms=(uint)(PermissionMask.Modify | |
485 | PermissionMask.Copy | | 490 | PermissionMask.Copy | |
@@ -487,18 +492,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
487 | PermissionMask.Transfer | | 492 | PermissionMask.Transfer | |
488 | PermissionMask.FoldedMask); | 493 | PermissionMask.FoldedMask); |
489 | 494 | ||
490 | uint ownerMask = 0x7fffffff; | 495 | uint ownerMask = RootPart.OwnerMask; |
491 | 496 | ||
492 | SceneObjectPart[] parts = m_parts.GetArray(); | 497 | SceneObjectPart[] parts = m_parts.GetArray(); |
493 | for (int i = 0; i < parts.Length; i++) | 498 | for (int i = 0; i < parts.Length; i++) |
494 | { | 499 | { |
495 | SceneObjectPart part = parts[i]; | 500 | SceneObjectPart part = parts[i]; |
496 | 501 | ownerMask &= part.BaseMask; | |
497 | if (useBase) | ||
498 | ownerMask &= part.BaseMask; | ||
499 | else | ||
500 | ownerMask &= part.OwnerMask; | ||
501 | |||
502 | perms &= part.Inventory.MaskEffectivePermissions(); | 502 | perms &= part.Inventory.MaskEffectivePermissions(); |
503 | } | 503 | } |
504 | 504 | ||