diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 101 |
1 files changed, 59 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 5d19025..8b68dbe 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -308,48 +308,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 311 | AddPermissions(item, objlist[0], objlist, remoteClient); |
312 | foreach (SceneObjectGroup grp in objlist) | ||
313 | effectivePerms &= grp.GetEffectivePermissions(); | ||
314 | effectivePerms |= (uint)PermissionMask.Move; | ||
315 | |||
316 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
317 | { | ||
318 | uint perms = effectivePerms; | ||
319 | uint nextPerms = (perms & 7) << 13; | ||
320 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
321 | perms &= ~(uint)PermissionMask.Copy; | ||
322 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
323 | perms &= ~(uint)PermissionMask.Transfer; | ||
324 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
325 | perms &= ~(uint)PermissionMask.Modify; | ||
326 | |||
327 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
328 | item.CurrentPermissions = item.BasePermissions; | ||
329 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
330 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
331 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
332 | |||
333 | // Magic number badness. Maybe this deserves an enum. | ||
334 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
335 | // and apply next owner perms on rez | ||
336 | item.CurrentPermissions |= 16; // Slam! | ||
337 | } | ||
338 | else | ||
339 | { | ||
340 | item.BasePermissions = effectivePerms; | ||
341 | item.CurrentPermissions = effectivePerms; | ||
342 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
343 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
344 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
345 | |||
346 | item.CurrentPermissions &= | ||
347 | ((uint)PermissionMask.Copy | | ||
348 | (uint)PermissionMask.Transfer | | ||
349 | (uint)PermissionMask.Modify | | ||
350 | (uint)PermissionMask.Move | | ||
351 | 7); // Preserve folded permissions | ||
352 | } | ||
353 | 312 | ||
354 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 313 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
355 | item.Description = asset.Description; | 314 | item.Description = asset.Description; |
@@ -377,6 +336,64 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
377 | } | 336 | } |
378 | 337 | ||
379 | /// <summary> | 338 | /// <summary> |
339 | /// Add relevant permissions for an object to the item. | ||
340 | /// </summary> | ||
341 | /// <param name="item"></param> | ||
342 | /// <param name="so"></param> | ||
343 | /// <param name="objsForEffectivePermissions"></param> | ||
344 | /// <param name="remoteClient"></param> | ||
345 | /// <returns></returns> | ||
346 | protected InventoryItemBase AddPermissions( | ||
347 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, | ||
348 | IClientAPI remoteClient) | ||
349 | { | ||
350 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
351 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | ||
352 | effectivePerms &= grp.GetEffectivePermissions(); | ||
353 | effectivePerms |= (uint)PermissionMask.Move; | ||
354 | |||
355 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
356 | { | ||
357 | uint perms = effectivePerms; | ||
358 | uint nextPerms = (perms & 7) << 13; | ||
359 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
360 | perms &= ~(uint)PermissionMask.Copy; | ||
361 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
362 | perms &= ~(uint)PermissionMask.Transfer; | ||
363 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
364 | perms &= ~(uint)PermissionMask.Modify; | ||
365 | |||
366 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | ||
367 | item.CurrentPermissions = item.BasePermissions; | ||
368 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
369 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
370 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
371 | |||
372 | // Magic number badness. Maybe this deserves an enum. | ||
373 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
374 | // and apply next owner perms on rez | ||
375 | item.CurrentPermissions |= 16; // Slam! | ||
376 | } | ||
377 | else | ||
378 | { | ||
379 | item.BasePermissions = effectivePerms; | ||
380 | item.CurrentPermissions = effectivePerms; | ||
381 | item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; | ||
382 | item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; | ||
383 | item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; | ||
384 | |||
385 | item.CurrentPermissions &= | ||
386 | ((uint)PermissionMask.Copy | | ||
387 | (uint)PermissionMask.Transfer | | ||
388 | (uint)PermissionMask.Modify | | ||
389 | (uint)PermissionMask.Move | | ||
390 | 7); // Preserve folded permissions | ||
391 | } | ||
392 | |||
393 | return item; | ||
394 | } | ||
395 | |||
396 | /// <summary> | ||
380 | /// Create an item using details for the given scene object. | 397 | /// Create an item using details for the given scene object. |
381 | /// </summary> | 398 | /// </summary> |
382 | /// <param name="action"></param> | 399 | /// <param name="action"></param> |