diff options
author | Melanie | 2013-03-31 20:25:32 +0200 |
---|---|---|
committer | Melanie | 2013-03-31 20:25:32 +0200 |
commit | 4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7 (patch) | |
tree | 6bbbfe887569aa4caff878e61fb18b66875c86f7 /OpenSim | |
parent | Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask (diff) | |
download | opensim-SC-4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7.zip opensim-SC-4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7.tar.gz opensim-SC-4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7.tar.bz2 opensim-SC-4bf9c4bbb833f8ecbd0757b333da76ffaea14bc7.tar.xz |
Export permission, part two. Setting export perms for textures and clothing works. Setting perms for prims also works but they don't propagate correctly yet.
NOT FOR PRODUCTIN USE. Your database will need to be updated before you can use this!
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 |
3 files changed, 66 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6a3fb24..d2e41f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -413,18 +413,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
413 | 413 | ||
414 | if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid | 414 | if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid |
415 | { | 415 | { |
416 | // Create a set of base permissions that will not include export if the user | ||
417 | // is not allowed to change the export flag. | ||
418 | bool denyExportChange = false; | ||
419 | |||
420 | m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); | ||
421 | |||
422 | // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export | ||
423 | if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner) | ||
424 | denyExportChange = true; | ||
425 | |||
426 | m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange); | ||
427 | |||
428 | // If it is already set, force it set and also force full perm | ||
429 | // else prevent setting it. It can and should never be set unless | ||
430 | // set in base, so the condition above is valid | ||
431 | if (denyExportChange) | ||
432 | { | ||
433 | // If we are not allowed to change it, then force it to the | ||
434 | // original item's setting and if it was on, also force full perm | ||
435 | if ((item.EveryOnePermissions & (uint)PermissionMask.Export) != 0) | ||
436 | { | ||
437 | itemUpd.NextPermissions = (uint)(PermissionMask.All); | ||
438 | itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export; | ||
439 | } | ||
440 | else | ||
441 | { | ||
442 | itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export; | ||
443 | } | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | // If the new state is exportable, force full perm | ||
448 | if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0) | ||
449 | { | ||
450 | m_log.InfoFormat("[XXX]: Force full perm"); | ||
451 | itemUpd.NextPermissions = (uint)(PermissionMask.All); | ||
452 | } | ||
453 | } | ||
454 | |||
416 | if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) | 455 | if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) |
417 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | 456 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; |
418 | item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; | 457 | item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; |
458 | |||
419 | if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) | 459 | if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) |
420 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | 460 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; |
421 | item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; | 461 | item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; |
462 | |||
422 | if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) | 463 | if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) |
423 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | 464 | item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; |
424 | |||
425 | // m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags); | ||
426 | |||
427 | item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; | 465 | item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; |
466 | |||
428 | item.GroupID = itemUpd.GroupID; | 467 | item.GroupID = itemUpd.GroupID; |
429 | item.GroupOwned = itemUpd.GroupOwned; | 468 | item.GroupOwned = itemUpd.GroupOwned; |
430 | item.CreationDate = itemUpd.CreationDate; | 469 | item.CreationDate = itemUpd.CreationDate; |
@@ -446,6 +485,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
446 | item.SaleType = itemUpd.SaleType; | 485 | item.SaleType = itemUpd.SaleType; |
447 | 486 | ||
448 | InventoryService.UpdateItem(item); | 487 | InventoryService.UpdateItem(item); |
488 | remoteClient.SendBulkUpdateInventory(item); | ||
449 | } | 489 | } |
450 | 490 | ||
451 | if (UUID.Zero != transactionID) | 491 | if (UUID.Zero != transactionID) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b109b4f..69fb6df 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3468,7 +3468,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3468 | 3468 | ||
3469 | public void AdjustChildPrimPermissions() | 3469 | public void AdjustChildPrimPermissions() |
3470 | { | 3470 | { |
3471 | uint newOwnerMask = (uint)PermissionMask.All & 0xfffffff8; // Mask folded bits | 3471 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits |
3472 | uint foldedPerms = RootPart.OwnerMask & 3; | 3472 | uint foldedPerms = RootPart.OwnerMask & 3; |
3473 | 3473 | ||
3474 | ForEachPart(part => | 3474 | ForEachPart(part => |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9265805..c2f0792 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -470,8 +470,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
470 | private uint _category; | 470 | private uint _category; |
471 | private Int32 _creationDate; | 471 | private Int32 _creationDate; |
472 | private uint _parentID = 0; | 472 | private uint _parentID = 0; |
473 | private uint _baseMask = (uint)PermissionMask.All; | 473 | private uint _baseMask = (uint)(PermissionMask.All | PermissionMask.Export); |
474 | private uint _ownerMask = (uint)PermissionMask.All; | 474 | private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export); |
475 | private uint _groupMask = (uint)PermissionMask.None; | 475 | private uint _groupMask = (uint)PermissionMask.None; |
476 | private uint _everyoneMask = (uint)PermissionMask.None; | 476 | private uint _everyoneMask = (uint)PermissionMask.None; |
477 | private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); | 477 | private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); |
@@ -4319,10 +4319,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4319 | 4319 | ||
4320 | public void TrimPermissions() | 4320 | public void TrimPermissions() |
4321 | { | 4321 | { |
4322 | BaseMask &= (uint)PermissionMask.All; | 4322 | BaseMask &= (uint)(PermissionMask.All | PermissionMask.Export); |
4323 | OwnerMask &= (uint)PermissionMask.All; | 4323 | OwnerMask &= (uint)(PermissionMask.All | PermissionMask.Export); |
4324 | GroupMask &= (uint)PermissionMask.All; | 4324 | GroupMask &= (uint)PermissionMask.All; |
4325 | EveryoneMask &= (uint)PermissionMask.All; | 4325 | EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export); |
4326 | NextOwnerMask &= (uint)PermissionMask.All; | 4326 | NextOwnerMask &= (uint)PermissionMask.All; |
4327 | } | 4327 | } |
4328 | 4328 | ||
@@ -4425,10 +4425,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
4425 | baseMask; | 4425 | baseMask; |
4426 | break; | 4426 | break; |
4427 | case 8: | 4427 | case 8: |
4428 | // Trying to set export permissions - extra checks | ||
4429 | if (set && (mask & (uint)PermissionMask.Export) != 0) | ||
4430 | { | ||
4431 | if ((OwnerMask & (uint)PermissionMask.Export) == 0 || (BaseMask & (uint)PermissionMask.Export) == 0 || (NextOwnerMask & (uint)PermissionMask.All) != (uint)PermissionMask.All) | ||
4432 | mask &= ~(uint)PermissionMask.Export; | ||
4433 | } | ||
4428 | EveryoneMask = ApplyMask(EveryoneMask, set, mask) & | 4434 | EveryoneMask = ApplyMask(EveryoneMask, set, mask) & |
4429 | baseMask; | 4435 | baseMask; |
4430 | break; | 4436 | break; |
4431 | case 16: | 4437 | case 16: |
4438 | // Force full perm if export | ||
4439 | if ((EveryoneMask & (uint)PermissionMask.Export) != 0) | ||
4440 | { | ||
4441 | NextOwnerMask = (uint)PermissionMask.All; | ||
4442 | break; | ||
4443 | } | ||
4432 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & | 4444 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & |
4433 | baseMask; | 4445 | baseMask; |
4434 | // Prevent the client from creating no copy, no transfer | 4446 | // Prevent the client from creating no copy, no transfer |
@@ -5225,9 +5237,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5225 | 5237 | ||
5226 | public void ApplyNextOwnerPermissions() | 5238 | public void ApplyNextOwnerPermissions() |
5227 | { | 5239 | { |
5228 | BaseMask &= NextOwnerMask; | 5240 | // Export needs to be preserved in the base and everyone |
5241 | // mask, but removed in the owner mask as a next owner | ||
5242 | // can never change the export status | ||
5243 | BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; | ||
5229 | OwnerMask &= NextOwnerMask; | 5244 | OwnerMask &= NextOwnerMask; |
5230 | EveryoneMask &= NextOwnerMask; | 5245 | EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; |
5231 | 5246 | ||
5232 | Inventory.ApplyNextOwnerPermissions(); | 5247 | Inventory.ApplyNextOwnerPermissions(); |
5233 | } | 5248 | } |