aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
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/SceneObjectPartInventory.cs
parentIf an agent is sitting, then do send the rotation in the agent update instead... (diff)
downloadopensim-SC-13f31fdf85c404896c166932730b7b8bc5416626.zip
opensim-SC-13f31fdf85c404896c166932730b7b8bc5416626.tar.gz
opensim-SC-13f31fdf85c404896c166932730b7b8bc5416626.tar.bz2
opensim-SC-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 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs74
1 files changed, 17 insertions, 57 deletions
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;