aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs85
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
5 files changed, 99 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9ae8612..b86f349 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -669,17 +669,13 @@ namespace OpenSim.Region.Framework.Scenes
669 // a mask 669 // a mask
670 if (item.InvType == (int)InventoryType.Object) 670 if (item.InvType == (int)InventoryType.Object)
671 { 671 {
672 // Create a safe mask for the current perms
673 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
674 foldedPerms |= permsMask;
675
676 bool isRootMod = (item.CurrentPermissions & 672 bool isRootMod = (item.CurrentPermissions &
677 (uint)PermissionMask.Modify) != 0 ? 673 (uint)PermissionMask.Modify) != 0 ?
678 true : false; 674 true : false;
679 675
680 // Mask the owner perms to the folded perms 676 // Mask the owner perms to the folded perms
681 ownerPerms &= foldedPerms; 677 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms);
682 basePerms &= foldedPerms; 678 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms);
683 679
684 // If the root was mod, let the mask reflect that 680 // If the root was mod, let the mask reflect that
685 // We also need to adjust the base here, because 681 // We also need to adjust the base here, because
@@ -1209,9 +1205,16 @@ namespace OpenSim.Region.Framework.Scenes
1209 { 1205 {
1210 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1206 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1211 if (taskItem.InvType == (int)InventoryType.Object) 1207 if (taskItem.InvType == (int)InventoryType.Object)
1212 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); 1208 {
1209 uint perms = taskItem.CurrentPermissions;
1210 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1211 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1212 agentItem.CurrentPermissions = agentItem.BasePermissions;
1213 }
1213 else 1214 else
1215 {
1214 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 1216 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
1217 }
1215 1218
1216 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; 1219 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1217 agentItem.NextPermissions = taskItem.NextPermissions; 1220 agentItem.NextPermissions = taskItem.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 44c476c..c6b98ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -109,6 +109,9 @@ namespace OpenSim.Region.Framework.Scenes
109 STATUS_ROTATE_Z = 0x008, 109 STATUS_ROTATE_Z = 0x008,
110 } 110 }
111 111
112 // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
113 public static readonly uint SLAM = 16;
114
112 // private PrimCountTaintedDelegate handlerPrimCountTainted = null; 115 // private PrimCountTaintedDelegate handlerPrimCountTainted = null;
113 116
114 /// <summary> 117 /// <summary>
@@ -3230,13 +3233,10 @@ namespace OpenSim.Region.Framework.Scenes
3230 3233
3231 Vector3 oldPos; 3234 Vector3 oldPos;
3232 3235
3233 // FIXME: This improves the situation where editing just the root prim of an attached object would send
3234 // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim
3235 // still ends up in the wrong position on reattach.
3236 if (IsAttachment) 3236 if (IsAttachment)
3237 oldPos = RootPart.OffsetPosition; 3237 oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim
3238 else 3238 else
3239 oldPos = AbsolutePosition + RootPart.OffsetPosition; 3239 oldPos = AbsolutePosition + m_rootPart.OffsetPosition;
3240 3240
3241 Vector3 diff = oldPos - newPos; 3241 Vector3 diff = oldPos - newPos;
3242 Quaternion partRotation = m_rootPart.RotationOffset; 3242 Quaternion partRotation = m_rootPart.RotationOffset;
@@ -3251,6 +3251,9 @@ namespace OpenSim.Region.Framework.Scenes
3251 } 3251 }
3252 3252
3253 AbsolutePosition = newPos; 3253 AbsolutePosition = newPos;
3254
3255 if (IsAttachment)
3256 m_rootPart.AttachedPos = newPos;
3254 3257
3255 HasGroupChanged = true; 3258 HasGroupChanged = true;
3256 ScheduleGroupForTerseUpdate(); 3259 ScheduleGroupForTerseUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ea9d0d8..1cf7726 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4800,6 +4800,64 @@ namespace OpenSim.Region.Framework.Scenes
4800 { 4800 {
4801 ParentGroup.AddScriptLPS(count); 4801 ParentGroup.AddScriptLPS(count);
4802 } 4802 }
4803
4804 /// <summary>
4805 /// Sets a prim's owner and permissions when it's rezzed.
4806 /// </summary>
4807 /// <param name="item">The inventory item from which the item was rezzed</param>
4808 /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param>
4809 /// <param name="scene">The scene the prim is being rezzed into</param>
4810 public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
4811 {
4812 if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
4813 {
4814 if (scene.Permissions.PropagatePermissions())
4815 {
4816 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
4817 {
4818 // Apply the item's permissions to the object
4819 //LogPermissions("Before applying item permissions");
4820 if (userInventory)
4821 {
4822 EveryoneMask = item.EveryOnePermissions;
4823 NextOwnerMask = item.NextPermissions;
4824 }
4825 else
4826 {
4827 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
4828 EveryoneMask = item.EveryOnePermissions;
4829 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
4830 NextOwnerMask = item.NextPermissions;
4831 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
4832 GroupMask = item.GroupPermissions;
4833 }
4834 //LogPermissions("After applying item permissions");
4835 }
4836 }
4837
4838 GroupMask = 0; // DO NOT propagate here
4839 }
4840
4841 if (OwnerID != item.Owner)
4842 {
4843 //LogPermissions("Before ApplyNextOwnerPermissions");
4844 ApplyNextOwnerPermissions();
4845 //LogPermissions("After ApplyNextOwnerPermissions");
4846
4847 LastOwnerID = OwnerID;
4848 OwnerID = item.Owner;
4849 Inventory.ChangeInventoryOwner(item.Owner);
4850 }
4851 }
4852
4853 /// <summary>
4854 /// Logs the prim's permissions. Useful when debugging permission problems.
4855 /// </summary>
4856 /// <param name="message"></param>
4857 private void LogPermissions(String message)
4858 {
4859 PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
4860 }
4803 4861
4804 public void ApplyNextOwnerPermissions() 4862 public void ApplyNextOwnerPermissions()
4805 { 4863 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 380e402..fb8ecd5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -764,48 +764,27 @@ namespace OpenSim.Region.Framework.Scenes
764 // Since renaming the item in the inventory does not affect the name stored 764 // Since renaming the item in the inventory does not affect the name stored
765 // in the serialization, transfer the correct name from the inventory to the 765 // in the serialization, transfer the correct name from the inventory to the
766 // object itself before we rez. 766 // object itself before we rez.
767 rootPart.Name = item.Name; 767 // Only do these for the first object if we are rezzing a coalescence.
768 rootPart.Description = item.Description; 768 if (i == 0)
769
770 SceneObjectPart[] partList = group.Parts;
771
772 group.SetGroup(m_part.GroupID, null);
773
774 // TODO: Remove magic number badness
775 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
776 { 769 {
777 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) 770 rootPart.Name = item.Name;
778 { 771 rootPart.Description = item.Description;
779 foreach (SceneObjectPart part in partList)
780 {
781 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
782 part.EveryoneMask = item.EveryonePermissions;
783 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
784 part.NextOwnerMask = item.NextPermissions;
785 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
786 part.GroupMask = item.GroupPermissions;
787 }
788
789 group.ApplyNextOwnerPermissions();
790 }
791 } 772 }
792 773
793 foreach (SceneObjectPart part in partList) 774 group.SetGroup(m_part.GroupID, null);
794 {
795 // TODO: Remove magic number badness
796 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
797 {
798 part.LastOwnerID = part.OwnerID;
799 part.OwnerID = item.OwnerID;
800 part.Inventory.ChangeInventoryOwner(item.OwnerID);
801 }
802 775
803 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) 776 foreach (SceneObjectPart part in group.Parts)
804 part.EveryoneMask = item.EveryonePermissions; 777 {
805 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) 778 // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :)
806 part.NextOwnerMask = item.NextPermissions; 779 InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID);
807 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) 780 dest.BasePermissions = item.BasePermissions;
808 part.GroupMask = item.GroupPermissions; 781 dest.CurrentPermissions = item.CurrentPermissions;
782 dest.EveryOnePermissions = item.EveryonePermissions;
783 dest.GroupPermissions = item.GroupPermissions;
784 dest.NextPermissions = item.NextPermissions;
785 dest.Flags = item.Flags;
786
787 part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene);
809 } 788 }
810 789
811 rootPart.TrimPermissions(); 790 rootPart.TrimPermissions();
@@ -1130,25 +1109,6 @@ namespace OpenSim.Region.Framework.Scenes
1130 mask &= ~((uint)PermissionMask.Transfer >> 13); 1109 mask &= ~((uint)PermissionMask.Transfer >> 13);
1131 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) 1110 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
1132 mask &= ~((uint)PermissionMask.Modify >> 13); 1111 mask &= ~((uint)PermissionMask.Modify >> 13);
1133
1134 if (item.InvType != (int)InventoryType.Object)
1135 {
1136 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
1137 mask &= ~((uint)PermissionMask.Copy >> 13);
1138 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
1139 mask &= ~((uint)PermissionMask.Transfer >> 13);
1140 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
1141 mask &= ~((uint)PermissionMask.Modify >> 13);
1142 }
1143 else
1144 {
1145 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
1146 mask &= ~((uint)PermissionMask.Copy >> 13);
1147 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
1148 mask &= ~((uint)PermissionMask.Transfer >> 13);
1149 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1150 mask &= ~((uint)PermissionMask.Modify >> 13);
1151 }
1152 1112
1153 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1113 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1154 mask &= ~(uint)PermissionMask.Copy; 1114 mask &= ~(uint)PermissionMask.Copy;
@@ -1172,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes
1172// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", 1132// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
1173// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); 1133// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
1174 1134
1175 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) 1135 if (item.InvType == (int)InventoryType.Object)
1176 { 1136 {
1177 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) 1137 uint perms = item.CurrentPermissions;
1178 item.CurrentPermissions &= ~(uint)PermissionMask.Copy; 1138 PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
1179 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) 1139 item.CurrentPermissions = perms;
1180 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1181 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1182 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1183 } 1140 }
1184 1141
1185 item.CurrentPermissions &= item.NextPermissions; 1142 item.CurrentPermissions &= item.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a98baea..b52f48c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1900,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1900 ControllingClient.SendAgentTerseUpdate(this); 1900 ControllingClient.SendAgentTerseUpdate(this);
1901 1901
1902 PhysicsActor actor = PhysicsActor; 1902 PhysicsActor actor = PhysicsActor;
1903
1904 // This will be the case if the agent is sitting on the groudn or on an object.
1903 if (actor == null) 1905 if (actor == null)
1904 { 1906 {
1905 SendControlsToScripts(flagsForScripts); 1907 SendControlsToScripts(flagsForScripts);