aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorOren Hurvitz2013-11-05 15:42:23 +0200
committerJustin Clark-Casey (justincc)2014-01-10 19:50:03 +0000
commit91fd9c467083a57e2898594ce3ae764aa0525bb5 (patch)
tree32078bfcfec717530d29f18d8b2afb6b41cfbab3 /OpenSim/Region/Framework
parentRefactored setting permissions when rezzing items: use the same function when... (diff)
downloadopensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.zip
opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.gz
opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.bz2
opensim-SC_OLD-91fd9c467083a57e2898594ce3ae764aa0525bb5.tar.xz
Refactored: use a single function to apply an object's folded permissions to its main permissions
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs11
2 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 65536db..9cc5cde 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/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 5fa01e3..fb8ecd5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1132,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes
1132// "[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}",
1133// 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);
1134 1134
1135 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) 1135 if (item.InvType == (int)InventoryType.Object)
1136 { 1136 {
1137 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) 1137 uint perms = item.CurrentPermissions;
1138 item.CurrentPermissions &= ~(uint)PermissionMask.Copy; 1138 PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
1139 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) 1139 item.CurrentPermissions = perms;
1140 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1141 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1142 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1143 } 1140 }
1144 1141
1145 item.CurrentPermissions &= item.NextPermissions; 1142 item.CurrentPermissions &= item.NextPermissions;