diff options
author | UbitUmarov | 2017-01-22 03:23:50 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-22 03:23:50 +0000 |
commit | 50e318c401f69b7b3946b0a630d455bf7fe4118c (patch) | |
tree | fcdf94348e955ee39325a97ff05bb067a0d5ecdd /OpenSim/Region/Framework | |
parent | a few more changes on permissions (diff) | |
download | opensim-SC-50e318c401f69b7b3946b0a630d455bf7fe4118c.zip opensim-SC-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.gz opensim-SC-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.bz2 opensim-SC-50e318c401f69b7b3946b0a630d455bf7fe4118c.tar.xz |
work around group sharing and owned permitions issues, fix a non copy objects delete issue
Diffstat (limited to '')
3 files changed, 54 insertions, 43 deletions
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 | } |