aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-01-22 03:23:50 +0000
committerUbitUmarov2017-01-22 03:23:50 +0000
commit50e318c401f69b7b3946b0a630d455bf7fe4118c (patch)
treefcdf94348e955ee39325a97ff05bb067a0d5ecdd /OpenSim
parenta few more changes on permissions (diff)
downloadopensim-SC_OLD-50e318c401f69b7b3946b0a630d455bf7fe4118c.zip
opensim-SC_OLD-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.gz
opensim-SC_OLD-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.bz2
opensim-SC_OLD-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.xz
work around group sharing and owned permitions issues, fix a non copy objects delete issue
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs206
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs32
4 files changed, 214 insertions, 89 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 890d07a..e16022d 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
267 m_scene.Permissions.OnIsAdministrator += IsAdministrator; 267 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
268 m_scene.Permissions.OnIsEstateManager += IsEstateManager; 268 m_scene.Permissions.OnIsEstateManager += IsEstateManager;
269 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 269 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
270 m_scene.Permissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
270 m_scene.Permissions.OnDeleteObject += CanDeleteObject; 271 m_scene.Permissions.OnDeleteObject += CanDeleteObject;
271 m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs; 272 m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
272 m_scene.Permissions.OnEditObject += CanEditObject; 273 m_scene.Permissions.OnEditObject += CanEditObject;
@@ -674,6 +675,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
674 PrimFlags.ObjectAnyOwner // Tells client that someone owns the object 675 PrimFlags.ObjectAnyOwner // Tells client that someone owns the object
675 ); 676 );
676 677
678 const uint SHAREDMASK = (uint)(
679 PermissionMask.Move |
680 PermissionMask.Modify |
681 PermissionMask.Copy
682 );
683
677 public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms) 684 public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms)
678 { 685 {
679 if(sp == null || task == null || curEffectivePerms == 0) 686 if(sp == null || task == null || curEffectivePerms == 0)
@@ -749,20 +756,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
749 ulong powers = 0; 756 ulong powers = 0;
750 if(taskGroupID != UUID.Zero && GroupMemberPowers(taskGroupID, sp, ref powers)) 757 if(taskGroupID != UUID.Zero && GroupMemberPowers(taskGroupID, sp, ref powers))
751 { 758 {
752 if(groupdOwned) 759 // shared as priority over group roles
760 bool notShared = (grp.EffectiveGroupPerms & SHAREDMASK) == 0;
761 if(groupdOwned && notShared)
753 { 762 {
754 // object is owned by group, check role powers 763 // object is owned by group, check role powers
755 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0) 764 if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
756 {
757 returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
758 returnMask |=
759 (uint)PrimFlags.ObjectGroupOwned |
760 (uint)PrimFlags.ObjectAnyOwner;
761 if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
762 returnMask |= (uint)PrimFlags.ObjectOwnerModify;
763 return returnMask;
764 }
765 else
766 { 765 {
767 // group sharing or everyone 766 // group sharing or everyone
768 returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked); 767 returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
@@ -771,12 +770,30 @@ namespace OpenSim.Region.CoreModules.World.Permissions
771 (uint)PrimFlags.ObjectAnyOwner; 770 (uint)PrimFlags.ObjectAnyOwner;
772 return returnMask; 771 return returnMask;
773 } 772 }
773
774 // we may have copy without transfer
775 uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
776 if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
777 grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
778 returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
779 returnMask |=
780 (uint)PrimFlags.ObjectGroupOwned |
781 (uint)PrimFlags.ObjectAnyOwner;
782 if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
783 returnMask |= (uint)PrimFlags.ObjectOwnerModify;
784 return returnMask;
774 } 785 }
775 else 786 else
776 { 787 {
777 // group sharing or everyone 788 // group sharing or everyone
778 returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked); 789 returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
779 if (taskOwnerID != UUID.Zero) 790 if(groupdOwned)
791 {
792 returnMask |=
793 (uint)PrimFlags.ObjectGroupOwned |
794 (uint)PrimFlags.ObjectAnyOwner;
795 }
796 else if (taskOwnerID != UUID.Zero)
780 returnMask |= (uint)PrimFlags.ObjectAnyOwner; 797 returnMask |= (uint)PrimFlags.ObjectAnyOwner;
781 return returnMask; 798 return returnMask;
782 } 799 }
@@ -886,18 +903,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
886 return group.EffectiveOwnerPerms & lockmask; 903 return group.EffectiveOwnerPerms & lockmask;
887 904
888 UUID sogGroupID = group.GroupID; 905 UUID sogGroupID = group.GroupID;
889 if (sogGroupID != UUID.Zero) 906 ulong powers = 0;
907 if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, currentUser, ref powers))
890 { 908 {
891 ulong powers = 0; 909 bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
892 if(GroupMemberPowers(sogGroupID, currentUser, ref powers)) 910
893 { 911 if(Shared || sogGroupID != objectOwner)
894 if(sogGroupID == objectOwner)
895 {
896 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
897 return group.EffectiveOwnerPerms & lockmask;
898 }
899 return group.EffectiveGroupOrEveryOnePerms & lockmask; 912 return group.EffectiveGroupOrEveryOnePerms & lockmask;
900 } 913
914 if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
915 return group.EffectiveGroupOrEveryOnePerms & lockmask;
916
917 uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask;
918 if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
919 grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
920 return grpEffectiveOwnerPerms;
901 } 921 }
902 922
903 return group.EffectiveEveryOnePerms & lockmask; 923 return group.EffectiveEveryOnePerms & lockmask;
@@ -939,18 +959,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
939 return group.EffectiveOwnerPerms & lockmask; 959 return group.EffectiveOwnerPerms & lockmask;
940 960
941 UUID sogGroupID = group.GroupID; 961 UUID sogGroupID = group.GroupID;
942 if (sogGroupID != UUID.Zero) 962 ulong powers = 0;
963 if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, sp, ref powers))
943 { 964 {
944 ulong powers = 0; 965 bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
945 if(GroupMemberPowers(sogGroupID, sp, ref powers)) 966
946 { 967 if(Shared || sogGroupID != objectOwner)
947 if(sogGroupID == objectOwner)
948 {
949 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
950 return group.EffectiveOwnerPerms & lockmask;
951 }
952 return group.EffectiveGroupOrEveryOnePerms & lockmask; 968 return group.EffectiveGroupOrEveryOnePerms & lockmask;
953 } 969
970 if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
971 return group.EffectiveGroupOrEveryOnePerms & lockmask;
972
973 uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask;
974 if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
975 grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
976 return grpEffectiveOwnerPerms;
954 } 977 }
955 978
956 return group.EffectiveEveryOnePerms & lockmask; 979 return group.EffectiveEveryOnePerms & lockmask;
@@ -1167,15 +1190,59 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1167 if((perms & (uint)PermissionMask.Copy) == 0) 1190 if((perms & (uint)PermissionMask.Copy) == 0)
1168 return false; 1191 return false;
1169 1192
1170 if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0) 1193 if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
1171 return false; 1194 return false;
1172 1195
1173 //If they can rez, they can duplicate 1196 //If they can rez, they can duplicate
1174 return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene); 1197 return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene);
1175 } 1198 }
1176 1199
1177 private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene) 1200 private bool CanDeleteObject(SceneObjectGroup sog, ScenePresence sp)
1201 {
1202 // ignoring locked. viewers should warn and ask for confirmation
1203
1204 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1205 if (m_bypassPermissions) return m_bypassPermissionsValue;
1206
1207 if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
1208 return false;
1209
1210 if(sog.IsAttachment)
1211 return false;
1212
1213 UUID sogOwnerID = sog.OwnerID;
1214 UUID spID = sp.UUID;
1215
1216 if(sogOwnerID == spID)
1217 return true;
1218
1219 if (sp.IsGod)
1220 return true;
1221
1222 if (IsFriendWithPerms(sog.UUID, sogOwnerID))
1223 return true;
1224
1225 UUID sogGroupID = sog.GroupID;
1226 if (sogGroupID != UUID.Zero)
1227 {
1228 ulong powers = 0;
1229 if(GroupMemberPowers(sogGroupID, sp, ref powers))
1230 {
1231 if(sogGroupID == sogOwnerID)
1232 {
1233 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
1234 return true;
1235 }
1236 return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
1237 }
1238 }
1239 return false;
1240 }
1241
1242 private bool CanDeleteObjectByIDs(UUID objectID, UUID userID, Scene scene)
1178 { 1243 {
1244 // ignoring locked. viewers should warn and ask for confirmation
1245
1179 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1246 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1180 if (m_bypassPermissions) return m_bypassPermissionsValue; 1247 if (m_bypassPermissions) return m_bypassPermissionsValue;
1181 1248
@@ -1183,11 +1250,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1183 if (sog == null) 1250 if (sog == null)
1184 return false; 1251 return false;
1185 1252
1186 // ignoring locked. viewers should warn and ask for confirmation 1253 if(sog.IsAttachment)
1187 uint perms = GetObjectPermissions(userID, sog, false);
1188 if((perms & (uint)PermissionMask.Modify) == 0)
1189 return false; 1254 return false;
1190 return true; 1255
1256 UUID sogOwnerID = sog.OwnerID;
1257
1258 if(sogOwnerID == userID)
1259 return true;
1260
1261 if (IsAdministrator(userID))
1262 return true;
1263
1264 if (IsFriendWithPerms(objectID, sogOwnerID))
1265 return true;
1266
1267 UUID sogGroupID = sog.GroupID;
1268 if (sogGroupID != UUID.Zero)
1269 {
1270 ulong powers = 0;
1271 if(GroupMemberPowers(sogGroupID, userID, ref powers))
1272 {
1273 if(sogGroupID == sogOwnerID)
1274 {
1275 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
1276 return true;
1277 }
1278 return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
1279 }
1280 }
1281 return false;
1191 } 1282 }
1192 1283
1193 private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene) 1284 private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
@@ -1667,6 +1758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1667 1758
1668 private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp) 1759 private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
1669 { 1760 {
1761 // ignore locked, viewers shell ask for confirmation
1670 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1762 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1671 if (m_bypassPermissions) return m_bypassPermissionsValue; 1763 if (m_bypassPermissions) return m_bypassPermissionsValue;
1672 1764
@@ -1677,14 +1769,36 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1677 if(sog.IsAttachment) 1769 if(sog.IsAttachment)
1678 return false; 1770 return false;
1679 1771
1680 // ignore locked, viewers shell ask for confirmation 1772 UUID sogOwnerID = sog.OwnerID;
1681 uint perms = GetObjectPermissions(sp, sog, false); 1773 UUID spID = sp.UUID;
1682 if((perms & (uint)PermissionMask.Modify) == 0) 1774
1775 if(sogOwnerID == spID)
1776 return true;
1777
1778 if (sp.IsGod)
1779 return true;
1780
1781 if((sog.EffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
1683 return false; 1782 return false;
1783
1784 if (IsFriendWithPerms(sog.UUID, sogOwnerID))
1785 return true;
1684 1786
1685 if (sog.OwnerID != sp.UUID && ((perms & (uint)PermissionMask.Transfer) == 0)) 1787 UUID sogGroupID = sog.GroupID;
1686 return false; 1788 if (sogGroupID != UUID.Zero)
1687 return true; 1789 {
1790 ulong powers = 0;
1791 if(GroupMemberPowers(sogGroupID, sp, ref powers))
1792 {
1793 if(sogGroupID == sogOwnerID)
1794 {
1795 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
1796 return true;
1797 }
1798 return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
1799 }
1800 }
1801 return false;
1688 } 1802 }
1689 1803
1690 private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp) 1804 private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
@@ -1703,7 +1817,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1703 if((perms & (uint)PermissionMask.Copy) == 0) 1817 if((perms & (uint)PermissionMask.Copy) == 0)
1704 return false; 1818 return false;
1705 1819
1706 if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0) 1820 if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
1707 return false; 1821 return false;
1708 return true; 1822 return true;
1709 } 1823 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 3230a2b..a1eb721 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1380,18 +1380,10 @@ namespace OpenSim.Region.Framework.Scenes
1380 return; 1380 return;
1381 } 1381 }
1382 1382
1383 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1383 if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId))
1384 { 1384 {
1385 // If the item to be moved is no copy, we need to be able to 1385 // check also if we can delete the no copy item
1386 // edit the prim. 1386 if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId))
1387 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
1388 return;
1389 }
1390 else
1391 {
1392 // If the item is copiable, then we just need to have perms
1393 // on it. The delete check is a pure rights check
1394 if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
1395 return; 1387 return;
1396 } 1388 }
1397 1389
@@ -2125,6 +2117,7 @@ namespace OpenSim.Region.Framework.Scenes
2125 List<uint> deleteIDs = new List<uint>(); 2117 List<uint> deleteIDs = new List<uint>();
2126 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); 2118 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
2127 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); 2119 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
2120 List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>();
2128 2121
2129 ScenePresence sp = remoteClient.SceneAgent as ScenePresence; 2122 ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
2130 2123
@@ -2192,7 +2185,7 @@ namespace OpenSim.Region.Framework.Scenes
2192 if (!Permissions.CanTakeObject(grp, sp)) 2185 if (!Permissions.CanTakeObject(grp, sp))
2193 permissionToTake = false; 2186 permissionToTake = false;
2194 2187
2195 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 2188 if (!Permissions.CanDeleteObject(grp, remoteClient))
2196 permissionToDelete = false; 2189 permissionToDelete = false;
2197 } 2190 }
2198 2191
@@ -2249,26 +2242,24 @@ namespace OpenSim.Region.Framework.Scenes
2249 } 2242 }
2250 } 2243 }
2251 2244
2252 if (permissionToTake && (!permissionToDelete))
2253 takeGroups.Add(grp);
2254
2255 if (permissionToDelete) 2245 if (permissionToDelete)
2256 { 2246 {
2257 if (permissionToTake) 2247 if (permissionToTake)
2248 takeDeleteGroups.Add(grp);
2249 else
2258 deleteGroups.Add(grp); 2250 deleteGroups.Add(grp);
2259 deleteIDs.Add(grp.LocalId); 2251 deleteIDs.Add(grp.LocalId);
2260 } 2252 }
2253 else if(permissionToTake)
2254 takeGroups.Add(grp);
2261 } 2255 }
2262 2256
2263 SendKillObject(deleteIDs); 2257 SendKillObject(deleteIDs);
2264 2258
2265 if (deleteGroups.Count > 0) 2259 if (takeDeleteGroups.Count > 0)
2266 { 2260 {
2267 foreach (SceneObjectGroup g in deleteGroups)
2268 deleteIDs.Remove(g.LocalId);
2269
2270 m_asyncSceneObjectDeleter.DeleteToInventory( 2261 m_asyncSceneObjectDeleter.DeleteToInventory(
2271 action, destinationID, deleteGroups, remoteClient, 2262 action, destinationID, takeDeleteGroups, remoteClient,
2272 true); 2263 true);
2273 } 2264 }
2274 if (takeGroups.Count > 0) 2265 if (takeGroups.Count > 0)
@@ -2277,7 +2268,7 @@ namespace OpenSim.Region.Framework.Scenes
2277 action, destinationID, takeGroups, remoteClient, 2268 action, destinationID, takeGroups, remoteClient,
2278 false); 2269 false);
2279 } 2270 }
2280 if (deleteIDs.Count > 0) 2271 if (deleteGroups.Count > 0)
2281 { 2272 {
2282 foreach (SceneObjectGroup g in deleteGroups) 2273 foreach (SceneObjectGroup g in deleteGroups)
2283 DeleteSceneObject(g, true); 2274 DeleteSceneObject(g, true);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e941210..754609a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -42,7 +42,8 @@ namespace OpenSim.Region.Framework.Scenes
42 public delegate bool BypassPermissionsHandler(); 42 public delegate bool BypassPermissionsHandler();
43 public delegate bool PropagatePermissionsHandler(); 43 public delegate bool PropagatePermissionsHandler();
44 public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); 44 public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
45 public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); 45 public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter, Scene scene);
46 public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
46 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); 47 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
47 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp); 48 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
48 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); 49 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
@@ -114,6 +115,7 @@ namespace OpenSim.Region.Framework.Scenes
114 public event BypassPermissionsHandler OnBypassPermissions; 115 public event BypassPermissionsHandler OnBypassPermissions;
115 public event PropagatePermissionsHandler OnPropagatePermissions; 116 public event PropagatePermissionsHandler OnPropagatePermissions;
116 public event RezObjectHandler OnRezObject; 117 public event RezObjectHandler OnRezObject;
118 public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
117 public event DeleteObjectHandler OnDeleteObject; 119 public event DeleteObjectHandler OnDeleteObject;
118 public event TransferObjectHandler OnTransferObject; 120 public event TransferObjectHandler OnTransferObject;
119 public event TakeObjectHandler OnTakeObject; 121 public event TakeObjectHandler OnTakeObject;
@@ -262,13 +264,39 @@ namespace OpenSim.Region.Framework.Scenes
262 { 264 {
263 bool result = true; 265 bool result = true;
264 266
267 DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
268 if (handler != null)
269 {
270 Delegate[] list = handler.GetInvocationList();
271 foreach (DeleteObjectHandlerByIDs h in list)
272 {
273 if (h(objectID, deleter, m_scene) == false)
274 {
275 result = false;
276 break;
277 }
278 }
279 }
280
281 return result;
282 }
283
284 public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
285 {
286 bool result = true;
287
265 DeleteObjectHandler handler = OnDeleteObject; 288 DeleteObjectHandler handler = OnDeleteObject;
266 if (handler != null) 289 if (handler != null)
267 { 290 {
291 if(sog == null || client == null || client.SceneAgent == null)
292 return false;
293
294 ScenePresence sp = client.SceneAgent as ScenePresence;
295
268 Delegate[] list = handler.GetInvocationList(); 296 Delegate[] list = handler.GetInvocationList();
269 foreach (DeleteObjectHandler h in list) 297 foreach (DeleteObjectHandler h in list)
270 { 298 {
271 if (h(objectID, deleter, m_scene) == false) 299 if (h(sog, sp) == false)
272 { 300 {
273 result = false; 301 result = false;
274 break; 302 break;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index b9fa8e4..ddb03c3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -315,8 +315,7 @@ namespace OpenSim.Region.Framework.Scenes
315 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); 315 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
316 316
317 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; 317 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
318 bool noBaseTransfer = (RootPart.OwnerID != RootPart.GroupID && 318 bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
319 (basePerms & (uint)PermissionMask.Transfer) == 0);
320 319
321 uint rootOwnerPerms = RootPart.OwnerMask; 320 uint rootOwnerPerms = RootPart.OwnerMask;
322 uint owner = rootOwnerPerms; 321 uint owner = rootOwnerPerms;
@@ -342,17 +341,17 @@ namespace OpenSim.Region.Framework.Scenes
342 341
343 owner &= basePerms; 342 owner &= basePerms;
344 m_EffectiveOwnerPerms = owner; 343 m_EffectiveOwnerPerms = owner;
344 uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
345 345
346 // recover modify and move 346 // recover modify and move
347 rootGroupPerms &= movemodmask; 347 rootGroupPerms &= movemodmask;
348 group |= rootGroupPerms; 348 group |= rootGroupPerms;
349 if(noBaseTransfer) 349 if(noBaseTransfer)
350 group &=~(uint)PermissionMask.Copy; 350 group &=~(uint)PermissionMask.Copy;
351 else
352 group |= ownertransfermask;
351 353
352 uint groupOrEveryone = group; 354 uint groupOrEveryone = group;
353
354 if((group & copytransfermast) == 0)
355 group |= (uint)PermissionMask.Transfer;
356 m_EffectiveGroupPerms = group & owner; 355 m_EffectiveGroupPerms = group & owner;
357 356
358 // recover move 357 // recover move
@@ -361,15 +360,12 @@ namespace OpenSim.Region.Framework.Scenes
361 everyone &= ~(uint)PermissionMask.Modify; 360 everyone &= ~(uint)PermissionMask.Modify;
362 if(noBaseTransfer) 361 if(noBaseTransfer)
363 everyone &=~(uint)PermissionMask.Copy; 362 everyone &=~(uint)PermissionMask.Copy;
363 else
364 everyone |= ownertransfermask;
364 365
365 groupOrEveryone |= everyone; 366 groupOrEveryone |= everyone;
366 367
367 if((everyone & copytransfermast) == 0)
368 everyone |= (uint)PermissionMask.Transfer;
369 m_EffectiveEveryOnePerms = everyone & owner; 368 m_EffectiveEveryOnePerms = everyone & owner;
370
371 if((groupOrEveryone & copytransfermast) == 0)
372 groupOrEveryone |= (uint)PermissionMask.Transfer;
373 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; 369 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
374 } 370 }
375 } 371 }
@@ -386,8 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
386 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); 382 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
387 383
388 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; 384 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
389 bool noBaseTransfer = (RootPart.OwnerID == RootPart.GroupID && 385 bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
390 (basePerms & (uint)PermissionMask.Transfer) == 0);
391 386
392 uint rootOwnerPerms = RootPart.OwnerMask; 387 uint rootOwnerPerms = RootPart.OwnerMask;
393 uint owner = rootOwnerPerms; 388 uint owner = rootOwnerPerms;
@@ -412,17 +407,17 @@ namespace OpenSim.Region.Framework.Scenes
412 407
413 owner &= basePerms; 408 owner &= basePerms;
414 m_EffectiveOwnerPerms = owner; 409 m_EffectiveOwnerPerms = owner;
410 uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
415 411
416 // recover modify and move 412 // recover modify and move
417 rootGroupPerms &= movemodmask; 413 rootGroupPerms &= movemodmask;
418 group |= rootGroupPerms; 414 group |= rootGroupPerms;
419 if(noBaseTransfer) 415 if(noBaseTransfer)
420 group &=~(uint)PermissionMask.Copy; 416 group &=~(uint)PermissionMask.Copy;
417 else
418 group |= ownertransfermask;
421 419
422 uint groupOrEveryone = group; 420 uint groupOrEveryone = group;
423
424 if((group & copytransfermast) == 0)
425 group |= (uint)PermissionMask.Transfer;
426 m_EffectiveGroupPerms = group & owner; 421 m_EffectiveGroupPerms = group & owner;
427 422
428 // recover move 423 // recover move
@@ -431,15 +426,12 @@ namespace OpenSim.Region.Framework.Scenes
431 everyone &= ~(uint)PermissionMask.Modify; 426 everyone &= ~(uint)PermissionMask.Modify;
432 if(noBaseTransfer) 427 if(noBaseTransfer)
433 everyone &=~(uint)PermissionMask.Copy; 428 everyone &=~(uint)PermissionMask.Copy;
429 else
430 everyone |= ownertransfermask;
434 431
435 groupOrEveryone |= everyone; 432 groupOrEveryone |= everyone;
436 433
437 if((everyone & copytransfermast) == 0)
438 everyone |= (uint)PermissionMask.Transfer;
439 m_EffectiveEveryOnePerms = everyone & owner; 434 m_EffectiveEveryOnePerms = everyone & owner;
440
441 if((groupOrEveryone & copytransfermast) == 0)
442 groupOrEveryone |= (uint)PermissionMask.Transfer;
443 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; 435 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
444 } 436 }
445 } 437 }