diff options
Diffstat (limited to 'OpenSim/Region/Framework')
5 files changed, 95 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f384462..cba75f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -664,17 +664,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
664 | // a mask | 664 | // a mask |
665 | if (item.InvType == (int)InventoryType.Object) | 665 | if (item.InvType == (int)InventoryType.Object) |
666 | { | 666 | { |
667 | // Create a safe mask for the current perms | ||
668 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | ||
669 | foldedPerms |= permsMask; | ||
670 | |||
671 | bool isRootMod = (item.CurrentPermissions & | 667 | bool isRootMod = (item.CurrentPermissions & |
672 | (uint)PermissionMask.Modify) != 0 ? | 668 | (uint)PermissionMask.Modify) != 0 ? |
673 | true : false; | 669 | true : false; |
674 | 670 | ||
675 | // Mask the owner perms to the folded perms | 671 | // Mask the owner perms to the folded perms |
676 | ownerPerms &= foldedPerms; | 672 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); |
677 | basePerms &= foldedPerms; | 673 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); |
678 | 674 | ||
679 | // If the root was mod, let the mask reflect that | 675 | // If the root was mod, let the mask reflect that |
680 | // We also need to adjust the base here, because | 676 | // We also need to adjust the base here, because |
@@ -1235,9 +1231,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1235 | { | 1231 | { |
1236 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1232 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
1237 | if (taskItem.InvType == (int)InventoryType.Object) | 1233 | if (taskItem.InvType == (int)InventoryType.Object) |
1238 | agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); | 1234 | { |
1235 | uint perms = taskItem.CurrentPermissions; | ||
1236 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | ||
1237 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | ||
1238 | agentItem.CurrentPermissions = agentItem.BasePermissions; | ||
1239 | } | ||
1239 | else | 1240 | else |
1241 | { | ||
1240 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1242 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
1243 | } | ||
1241 | 1244 | ||
1242 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1245 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1243 | agentItem.NextPermissions = taskItem.NextPermissions; | 1246 | agentItem.NextPermissions = taskItem.NextPermissions; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9db34fd..2420048 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -111,6 +111,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | STATUS_ROTATE_Z = 0x008, | 111 | STATUS_ROTATE_Z = 0x008, |
112 | } | 112 | } |
113 | 113 | ||
114 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm | ||
115 | public static readonly uint SLAM = 16; | ||
116 | |||
114 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 117 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
115 | 118 | ||
116 | /// <summary> | 119 | /// <summary> |
@@ -3810,13 +3813,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3810 | // needs to be called with phys building true | 3813 | // needs to be called with phys building true |
3811 | Vector3 oldPos; | 3814 | Vector3 oldPos; |
3812 | 3815 | ||
3813 | // FIXME: This improves the situation where editing just the root prim of an attached object would send | ||
3814 | // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim | ||
3815 | // still ends up in the wrong position on reattach. | ||
3816 | if (IsAttachment) | 3816 | if (IsAttachment) |
3817 | oldPos = RootPart.OffsetPosition; | 3817 | oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim |
3818 | else | 3818 | else |
3819 | oldPos = AbsolutePosition + RootPart.OffsetPosition; | 3819 | oldPos = AbsolutePosition + m_rootPart.OffsetPosition; |
3820 | 3820 | ||
3821 | Vector3 diff = oldPos - newPos; | 3821 | Vector3 diff = oldPos - newPos; |
3822 | Quaternion partRotation = m_rootPart.RotationOffset; | 3822 | Quaternion partRotation = m_rootPart.RotationOffset; |
@@ -3831,6 +3831,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3831 | } | 3831 | } |
3832 | 3832 | ||
3833 | AbsolutePosition = newPos; | 3833 | AbsolutePosition = newPos; |
3834 | |||
3835 | if (IsAttachment) | ||
3836 | m_rootPart.AttachedPos = newPos; | ||
3834 | 3837 | ||
3835 | HasGroupChanged = true; | 3838 | HasGroupChanged = true; |
3836 | if (m_rootPart.Undoing) | 3839 | if (m_rootPart.Undoing) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5851ec6..ce9baaa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -5293,6 +5293,64 @@ namespace OpenSim.Region.Framework.Scenes | |||
5293 | { | 5293 | { |
5294 | ParentGroup.AddScriptLPS(count); | 5294 | ParentGroup.AddScriptLPS(count); |
5295 | } | 5295 | } |
5296 | |||
5297 | /// <summary> | ||
5298 | /// Sets a prim's owner and permissions when it's rezzed. | ||
5299 | /// </summary> | ||
5300 | /// <param name="item">The inventory item from which the item was rezzed</param> | ||
5301 | /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param> | ||
5302 | /// <param name="scene">The scene the prim is being rezzed into</param> | ||
5303 | public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) | ||
5304 | { | ||
5305 | if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) | ||
5306 | { | ||
5307 | if (scene.Permissions.PropagatePermissions()) | ||
5308 | { | ||
5309 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
5310 | { | ||
5311 | // Apply the item's permissions to the object | ||
5312 | //LogPermissions("Before applying item permissions"); | ||
5313 | if (userInventory) | ||
5314 | { | ||
5315 | EveryoneMask = item.EveryOnePermissions; | ||
5316 | NextOwnerMask = item.NextPermissions; | ||
5317 | } | ||
5318 | else | ||
5319 | { | ||
5320 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
5321 | EveryoneMask = item.EveryOnePermissions; | ||
5322 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
5323 | NextOwnerMask = item.NextPermissions; | ||
5324 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
5325 | GroupMask = item.GroupPermissions; | ||
5326 | } | ||
5327 | //LogPermissions("After applying item permissions"); | ||
5328 | } | ||
5329 | } | ||
5330 | |||
5331 | GroupMask = 0; // DO NOT propagate here | ||
5332 | } | ||
5333 | |||
5334 | if (OwnerID != item.Owner) | ||
5335 | { | ||
5336 | //LogPermissions("Before ApplyNextOwnerPermissions"); | ||
5337 | ApplyNextOwnerPermissions(); | ||
5338 | //LogPermissions("After ApplyNextOwnerPermissions"); | ||
5339 | |||
5340 | LastOwnerID = OwnerID; | ||
5341 | OwnerID = item.Owner; | ||
5342 | Inventory.ChangeInventoryOwner(item.Owner); | ||
5343 | } | ||
5344 | } | ||
5345 | |||
5346 | /// <summary> | ||
5347 | /// Logs the prim's permissions. Useful when debugging permission problems. | ||
5348 | /// </summary> | ||
5349 | /// <param name="message"></param> | ||
5350 | private void LogPermissions(String message) | ||
5351 | { | ||
5352 | PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask); | ||
5353 | } | ||
5296 | 5354 | ||
5297 | public void ApplyNextOwnerPermissions() | 5355 | public void ApplyNextOwnerPermissions() |
5298 | { | 5356 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b4fc472..8893cc0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -916,48 +916,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | // Since renaming the item in the inventory does not affect the name stored | 916 | // Since renaming the item in the inventory does not affect the name stored |
917 | // in the serialization, transfer the correct name from the inventory to the | 917 | // in the serialization, transfer the correct name from the inventory to the |
918 | // object itself before we rez. | 918 | // object itself before we rez. |
919 | rootPart.Name = item.Name; | 919 | // Only do these for the first object if we are rezzing a coalescence. |
920 | rootPart.Description = item.Description; | 920 | if (i == 0) |
921 | |||
922 | SceneObjectPart[] partList = group.Parts; | ||
923 | |||
924 | group.SetGroup(m_part.GroupID, null); | ||
925 | |||
926 | // TODO: Remove magic number badness | ||
927 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
928 | { | 921 | { |
929 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 922 | rootPart.Name = item.Name; |
930 | { | 923 | rootPart.Description = item.Description; |
931 | foreach (SceneObjectPart part in partList) | ||
932 | { | ||
933 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
934 | part.EveryoneMask = item.EveryonePermissions; | ||
935 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
936 | part.NextOwnerMask = item.NextPermissions; | ||
937 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
938 | part.GroupMask = item.GroupPermissions; | ||
939 | } | ||
940 | |||
941 | group.ApplyNextOwnerPermissions(); | ||
942 | } | ||
943 | } | 924 | } |
944 | 925 | ||
945 | foreach (SceneObjectPart part in partList) | 926 | group.SetGroup(m_part.GroupID, null); |
946 | { | ||
947 | // TODO: Remove magic number badness | ||
948 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
949 | { | ||
950 | part.LastOwnerID = part.OwnerID; | ||
951 | part.OwnerID = item.OwnerID; | ||
952 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
953 | } | ||
954 | 927 | ||
955 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 928 | foreach (SceneObjectPart part in group.Parts) |
956 | part.EveryoneMask = item.EveryonePermissions; | 929 | { |
957 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 930 | // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :) |
958 | part.NextOwnerMask = item.NextPermissions; | 931 | InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID); |
959 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 932 | dest.BasePermissions = item.BasePermissions; |
960 | part.GroupMask = item.GroupPermissions; | 933 | dest.CurrentPermissions = item.CurrentPermissions; |
934 | dest.EveryOnePermissions = item.EveryonePermissions; | ||
935 | dest.GroupPermissions = item.GroupPermissions; | ||
936 | dest.NextPermissions = item.NextPermissions; | ||
937 | dest.Flags = item.Flags; | ||
938 | |||
939 | part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene); | ||
961 | } | 940 | } |
962 | 941 | ||
963 | rootPart.TrimPermissions(); | 942 | rootPart.TrimPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ff17f6..252c72f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1903,6 +1903,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1903 | ControllingClient.SendAgentTerseUpdate(this); | 1903 | ControllingClient.SendAgentTerseUpdate(this); |
1904 | 1904 | ||
1905 | PhysicsActor actor = PhysicsActor; | 1905 | PhysicsActor actor = PhysicsActor; |
1906 | |||
1907 | // This will be the case if the agent is sitting on the groudn or on an object. | ||
1906 | if (actor == null) | 1908 | if (actor == null) |
1907 | { | 1909 | { |
1908 | SendControlsToScripts(flagsForScripts); | 1910 | SendControlsToScripts(flagsForScripts); |