aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorOren Hurvitz2013-11-04 19:28:24 +0200
committerJustin Clark-Casey (justincc)2014-01-10 19:37:59 +0000
commit13f31fdf85c404896c166932730b7b8bc5416626 (patch)
tree7fc489557e3b3c040b02c185c5ea97bcdf85434d /OpenSim/Region/Framework/Scenes
parentIf an agent is sitting, then do send the rotation in the agent update instead... (diff)
downloadopensim-SC_OLD-13f31fdf85c404896c166932730b7b8bc5416626.zip
opensim-SC_OLD-13f31fdf85c404896c166932730b7b8bc5416626.tar.gz
opensim-SC_OLD-13f31fdf85c404896c166932730b7b8bc5416626.tar.bz2
opensim-SC_OLD-13f31fdf85c404896c166932730b7b8bc5416626.tar.xz
Refactored setting permissions when rezzing items: use the same function when rezzing from user inventory and prim inventory.
Also, fixed a bug: when rezzing a coalesced object from a prim's inventory, apply the coalesced object's name and description only to the first sub-object; not to all the objects in the coalescence. (This was already done correctly when rezzing from a user's inventory.)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs74
3 files changed, 78 insertions, 57 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4b4e4ba..23507f4 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>
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..5fa01e3 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;