aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-15 19:28:10 +0000
committerTeravus Ovares2008-05-15 19:28:10 +0000
commitd60e4574633e50d257730cc582a6efb63c8e9d7b (patch)
tree3c51a5db9284eec4a29962a877e4c2f9dd0fc51a /OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
parentremove my UserAppearance object, switch all code to use (diff)
downloadopensim-SC_OLD-d60e4574633e50d257730cc582a6efb63c8e9d7b.zip
opensim-SC_OLD-d60e4574633e50d257730cc582a6efb63c8e9d7b.tar.gz
opensim-SC_OLD-d60e4574633e50d257730cc582a6efb63c8e9d7b.tar.bz2
opensim-SC_OLD-d60e4574633e50d257730cc582a6efb63c8e9d7b.tar.xz
Committing patch from Melanie. 0001290: [PATCH] implement permissions propagation and script module hooks. Thanks Melanie!
* Implements quite a few inventory related perms. * (from Teravus) Fixes Take Copy
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs100
1 files changed, 70 insertions, 30 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 9a9314c..e1be8ff 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -44,18 +44,13 @@ namespace OpenSim.Region.Environment.Scenes
44 private string m_inventoryFileName = String.Empty; 44 private string m_inventoryFileName = String.Empty;
45 45
46 /// <summary> 46 /// <summary>
47 /// The inventory folder for this prim
48 /// </summary>
49 private LLUUID m_folderID = LLUUID.Zero;
50
51 /// <summary>
52 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see 47 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
53 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. 48 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
54 /// </summary> 49 /// </summary>
55 public LLUUID FolderID 50 public LLUUID FolderID
56 { 51 {
57 get { return m_folderID; } 52 get { return UUID; }
58 set { m_folderID = value; } 53 set { } // Don't allow assignment, or legacy prims wil b0rk
59 } 54 }
60 55
61 /// <summary> 56 /// <summary>
@@ -133,8 +128,6 @@ namespace OpenSim.Region.Environment.Scenes
133 { 128 {
134 item.LastOwnerID = item.OwnerID; 129 item.LastOwnerID = item.OwnerID;
135 item.OwnerID = ownerId; 130 item.OwnerID = ownerId;
136 item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
137 item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
138 } 131 }
139 } 132 }
140 } 133 }
@@ -291,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
291 /// <param name="item"></param> 284 /// <param name="item"></param>
292 public void AddInventoryItem(TaskInventoryItem item) 285 public void AddInventoryItem(TaskInventoryItem item)
293 { 286 {
294 item.ParentID = m_folderID; 287 item.ParentID = UUID;
295 item.CreationDate = 1000; 288 item.CreationDate = 1000;
296 item.ParentPartID = UUID; 289 item.ParentPartID = UUID;
297 290
@@ -486,7 +479,7 @@ namespace OpenSim.Region.Environment.Scenes
486 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches 479 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches
487 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality 480 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality
488 // isn't available (such as drag from prim inventory to agent inventory) 481 // isn't available (such as drag from prim inventory to agent inventory)
489 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, LLUUID.Zero); 482 InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero);
490 483
491 lock (m_taskInventory) 484 lock (m_taskInventory)
492 { 485 {
@@ -494,26 +487,15 @@ namespace OpenSim.Region.Environment.Scenes
494 { 487 {
495 invString.AddItemStart(); 488 invString.AddItemStart();
496 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 489 invString.AddNameValueLine("item_id", item.ItemID.ToString());
497 invString.AddNameValueLine("parent_id", m_folderID.ToString()); 490 invString.AddNameValueLine("parent_id", UUID.ToString());
498 491
499 invString.AddPermissionsStart(); 492 invString.AddPermissionsStart();
500 493
501 // FIXME: Temporary until permissions are properly sorted. 494 invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
502 invString.AddNameValueLine("base_mask", "7fffffff"); 495 invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
503 invString.AddNameValueLine("owner_mask", "7fffffff"); 496 invString.AddNameValueLine("group_mask", "00000000");
504 invString.AddNameValueLine("group_mask", "7fffffff"); 497 invString.AddNameValueLine("everyone_mask", "00000000");
505 invString.AddNameValueLine("everyone_mask", "7fffffff"); 498 invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
506 invString.AddNameValueLine("next_owner_mask", "7fffffff");
507
508// invString.AddNameValueLine("group_mask", "00000000");
509// invString.AddNameValueLine("everyone_mask", "00000000");
510// invString.AddNameValueLine("next_owner_mask", "00086000");
511
512// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
513// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
514// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask));
515// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask));
516// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
517 499
518 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 500 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
519 invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); 501 invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
@@ -538,8 +520,6 @@ namespace OpenSim.Region.Environment.Scenes
538 invString.AddNameValueLine("desc", item.Description + "|"); 520 invString.AddNameValueLine("desc", item.Description + "|");
539 521
540 invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); 522 invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
541// invString.AddNameValueLine("creation_date", "1209151453");
542
543 invString.AddSectionEnd(); 523 invString.AddSectionEnd();
544 } 524 }
545 } 525 }
@@ -629,5 +609,65 @@ namespace OpenSim.Region.Environment.Scenes
629 { 609 {
630 } 610 }
631 } 611 }
612
613 public uint MaskEffectivePermissions()
614 {
615 uint mask=0x7fffffff;
616
617 foreach (TaskInventoryItem item in m_taskInventory.Values)
618 {
619 if(item.InvType != 6)
620 {
621 if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
622 mask &= ~((uint)PermissionMask.Copy >> 13);
623 if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
624 mask &= ~((uint)PermissionMask.Transfer >> 13);
625 if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
626 mask &= ~((uint)PermissionMask.Modify >> 13);
627 }
628 else
629 {
630 if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0)
631 mask &= ~((uint)PermissionMask.Copy >> 13);
632 if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0)
633 mask &= ~((uint)PermissionMask.Transfer >> 13);
634 if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0)
635 mask &= ~((uint)PermissionMask.Modify >> 13);
636 }
637
638 if((item.OwnerMask & (uint)PermissionMask.Copy) == 0)
639 mask &= ~(uint)PermissionMask.Copy;
640 if((item.OwnerMask & (uint)PermissionMask.Transfer) == 0)
641 mask &= ~(uint)PermissionMask.Transfer;
642 if((item.OwnerMask & (uint)PermissionMask.Modify) == 0)
643 mask &= ~(uint)PermissionMask.Modify;
644 }
645 return mask;
646 }
647
648 public void ApplyNextOwnerPermissions()
649 {
650 BaseMask &= NextOwnerMask;
651 OwnerMask &= NextOwnerMask;
652 EveryoneMask &= NextOwnerMask;
653
654 foreach (TaskInventoryItem item in m_taskInventory.Values)
655 {
656 if(item.InvType == 6)
657 {
658 if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0)
659 item.OwnerMask &= ~(uint)PermissionMask.Copy;
660 if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0)
661 item.OwnerMask &= ~(uint)PermissionMask.Transfer;
662 if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0)
663 item.OwnerMask &= ~(uint)PermissionMask.Modify;
664 }
665 item.OwnerMask &= item.NextOwnerMask;
666 item.BaseMask &= item.NextOwnerMask;
667 item.EveryoneMask &= item.NextOwnerMask;
668 }
669
670 TriggerScriptChangedEvent(Changed.OWNER);
671 }
632 } 672 }
633} 673}