aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2013-03-31 21:59:44 +0100
committerMelanie2013-03-31 21:59:44 +0100
commit9b83e53b28fe42220a602f37ee8976eeee63302b (patch)
tree8b90cb6022295592719fb22726246a79255c583e
parentIn the flotasm asset cache, if we get a request for a file that we're activel... (diff)
downloadopensim-SC-9b83e53b28fe42220a602f37ee8976eeee63302b.zip
opensim-SC-9b83e53b28fe42220a602f37ee8976eeee63302b.tar.gz
opensim-SC-9b83e53b28fe42220a602f37ee8976eeee63302b.tar.bz2
opensim-SC-9b83e53b28fe42220a602f37ee8976eeee63302b.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!
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs29
3 files changed, 74 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 2ce778d..8ddaa60 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -418,18 +418,57 @@ namespace OpenSim.Region.Framework.Scenes
418 418
419 if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid 419 if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid
420 { 420 {
421 // Create a set of base permissions that will not include export if the user
422 // is not allowed to change the export flag.
423 bool denyExportChange = false;
424
425 m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
426
427 // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export
428 if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner)
429 denyExportChange = true;
430
431 m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange);
432
433 // If it is already set, force it set and also force full perm
434 // else prevent setting it. It can and should never be set unless
435 // set in base, so the condition above is valid
436 if (denyExportChange)
437 {
438 // If we are not allowed to change it, then force it to the
439 // original item's setting and if it was on, also force full perm
440 if ((item.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
441 {
442 itemUpd.NextPermissions = (uint)(PermissionMask.All);
443 itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export;
444 }
445 else
446 {
447 itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export;
448 }
449 }
450 else
451 {
452 // If the new state is exportable, force full perm
453 if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
454 {
455 m_log.InfoFormat("[XXX]: Force full perm");
456 itemUpd.NextPermissions = (uint)(PermissionMask.All);
457 }
458 }
459
421 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 460 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
422 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 461 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
423 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 462 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
463
424 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) 464 if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
425 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; 465 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
426 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 466 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
467
427 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 468 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
428 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 469 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
429
430// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
431
432 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 470 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
471
433 item.GroupID = itemUpd.GroupID; 472 item.GroupID = itemUpd.GroupID;
434 item.GroupOwned = itemUpd.GroupOwned; 473 item.GroupOwned = itemUpd.GroupOwned;
435 item.CreationDate = itemUpd.CreationDate; 474 item.CreationDate = itemUpd.CreationDate;
@@ -451,6 +490,7 @@ namespace OpenSim.Region.Framework.Scenes
451 item.SaleType = itemUpd.SaleType; 490 item.SaleType = itemUpd.SaleType;
452 491
453 InventoryService.UpdateItem(item); 492 InventoryService.UpdateItem(item);
493 remoteClient.SendBulkUpdateInventory(item);
454 } 494 }
455 495
456 if (UUID.Zero != transactionID) 496 if (UUID.Zero != transactionID)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0621e2a..9e7a986 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2671,11 +2671,20 @@ namespace OpenSim.Region.Framework.Scenes
2671 2671
2672 public void AdjustChildPrimPermissions() 2672 public void AdjustChildPrimPermissions()
2673 { 2673 {
2674 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
2675 uint foldedPerms = RootPart.OwnerMask & 3;
2676
2674 ForEachPart(part => 2677 ForEachPart(part =>
2675 { 2678 {
2679 newOwnerMask &= part.BaseMask;
2676 if (part != RootPart) 2680 if (part != RootPart)
2677 part.ClonePermissions(RootPart); 2681 part.ClonePermissions(RootPart);
2678 }); 2682 });
2683
2684 uint lockMask = ~(uint)PermissionMask.Move;
2685 uint lockBit = RootPart.OwnerMask & (uint)PermissionMask.Move;
2686 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
2687 RootPart.ScheduleFullUpdate();
2679 } 2688 }
2680 2689
2681 public void UpdatePermissions(UUID AgentID, byte field, uint localID, 2690 public void UpdatePermissions(UUID AgentID, byte field, uint localID,
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 847df03..ec9e87e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -424,8 +424,8 @@ namespace OpenSim.Region.Framework.Scenes
424 private uint _category; 424 private uint _category;
425 private Int32 _creationDate; 425 private Int32 _creationDate;
426 private uint _parentID = 0; 426 private uint _parentID = 0;
427 private uint _baseMask = (uint)PermissionMask.All; 427 private uint _baseMask = (uint)(PermissionMask.All | PermissionMask.Export);
428 private uint _ownerMask = (uint)PermissionMask.All; 428 private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export);
429 private uint _groupMask = (uint)PermissionMask.None; 429 private uint _groupMask = (uint)PermissionMask.None;
430 private uint _everyoneMask = (uint)PermissionMask.None; 430 private uint _everyoneMask = (uint)PermissionMask.None;
431 private uint _nextOwnerMask = (uint)PermissionMask.All; 431 private uint _nextOwnerMask = (uint)PermissionMask.All;
@@ -3876,10 +3876,10 @@ namespace OpenSim.Region.Framework.Scenes
3876 3876
3877 public void TrimPermissions() 3877 public void TrimPermissions()
3878 { 3878 {
3879 BaseMask &= (uint)PermissionMask.All; 3879 BaseMask &= (uint)(PermissionMask.All | PermissionMask.Export);
3880 OwnerMask &= (uint)PermissionMask.All; 3880 OwnerMask &= (uint)(PermissionMask.All | PermissionMask.Export);
3881 GroupMask &= (uint)PermissionMask.All; 3881 GroupMask &= (uint)PermissionMask.All;
3882 EveryoneMask &= (uint)PermissionMask.All; 3882 EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export);
3883 NextOwnerMask &= (uint)PermissionMask.All; 3883 NextOwnerMask &= (uint)PermissionMask.All;
3884 } 3884 }
3885 3885
@@ -3982,10 +3982,22 @@ namespace OpenSim.Region.Framework.Scenes
3982 baseMask; 3982 baseMask;
3983 break; 3983 break;
3984 case 8: 3984 case 8:
3985 // Trying to set export permissions - extra checks
3986 if (set && (mask & (uint)PermissionMask.Export) != 0)
3987 {
3988 if ((OwnerMask & (uint)PermissionMask.Export) == 0 || (BaseMask & (uint)PermissionMask.Export) == 0 || (NextOwnerMask & (uint)PermissionMask.All) != (uint)PermissionMask.All)
3989 mask &= ~(uint)PermissionMask.Export;
3990 }
3985 EveryoneMask = ApplyMask(EveryoneMask, set, mask) & 3991 EveryoneMask = ApplyMask(EveryoneMask, set, mask) &
3986 baseMask; 3992 baseMask;
3987 break; 3993 break;
3988 case 16: 3994 case 16:
3995 // Force full perm if export
3996 if ((EveryoneMask & (uint)PermissionMask.Export) != 0)
3997 {
3998 NextOwnerMask = (uint)PermissionMask.All;
3999 break;
4000 }
3989 NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & 4001 NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) &
3990 baseMask; 4002 baseMask;
3991 // Prevent the client from creating no mod, no copy 4003 // Prevent the client from creating no mod, no copy
@@ -4743,9 +4755,12 @@ namespace OpenSim.Region.Framework.Scenes
4743 4755
4744 public void ApplyNextOwnerPermissions() 4756 public void ApplyNextOwnerPermissions()
4745 { 4757 {
4746 BaseMask &= NextOwnerMask; 4758 // Export needs to be preserved in the base and everyone
4759 // mask, but removed in the owner mask as a next owner
4760 // can never change the export status
4761 BaseMask &= NextOwnerMask | (uint)PermissionMask.Export;
4747 OwnerMask &= NextOwnerMask; 4762 OwnerMask &= NextOwnerMask;
4748 EveryoneMask &= NextOwnerMask; 4763 EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
4749 4764
4750 Inventory.ApplyNextOwnerPermissions(); 4765 Inventory.ApplyNextOwnerPermissions();
4751 } 4766 }