aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
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
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 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs218
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs37
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs34
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs100
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs18
9 files changed, 309 insertions, 114 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 395d555..1eab16b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4528,7 +4528,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4528 handlerObjectPermissions = OnObjectPermissions; 4528 handlerObjectPermissions = OnObjectPermissions;
4529 4529
4530 if (handlerObjectPermissions != null) 4530 if (handlerObjectPermissions != null)
4531 OnObjectPermissions(this, AgentID, SessionID, field, localID, mask, set); 4531 handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
4532 } 4532 }
4533 } 4533 }
4534 4534
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 7cf2427..d31a250 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -143,6 +143,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
143 //Register functions with Scene External Checks! 143 //Register functions with Scene External Checks!
144 m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED 144 m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED
145 m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED 145 m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED
146 m_scene.ExternalChecks.addPropagatePermissions(PropagatePermissions); //FULLY IMPLEMENTED
146 m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED 147 m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED
147 m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED 148 m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED
148 m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED 149 m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED
@@ -251,6 +252,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
251 } 252 }
252#endregion 253#endregion
253 254
255 public bool PropagatePermissions()
256 {
257 return false;
258 }
259
254 public bool BypassPermissions() 260 public bool BypassPermissions()
255 { 261 {
256 return m_bypassPermissions; 262 return m_bypassPermissions;
@@ -813,7 +819,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
813 if (m_bypassPermissions) return m_bypassPermissionsValue; 819 if (m_bypassPermissions) return m_bypassPermissionsValue;
814 820
815 bool permission = GenericObjectPermission(userID, objectID,false); 821 bool permission = GenericObjectPermission(userID, objectID,false);
816 if (permission) 822 if (!permission)
817 { 823 {
818 if (!m_scene.Entities.ContainsKey(objectID)) 824 if (!m_scene.Entities.ContainsKey(objectID))
819 { 825 {
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 6d00f71..aa22740 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1339,11 +1339,11 @@ namespace OpenSim.Region.Environment.Scenes
1339 1339
1340 if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user)) 1340 if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user))
1341 { 1341 {
1342 obj.AddFlag(LLObject.ObjectFlags.JointWheel); 1342 obj.ParentGroup.RootPart.AddFlag(LLObject.ObjectFlags.JointWheel);
1343 } 1343 }
1344 else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user)) 1344 else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user))
1345 { 1345 {
1346 obj.RemFlag(LLObject.ObjectFlags.JointWheel); 1346 obj.ParentGroup.RootPart.RemFlag(LLObject.ObjectFlags.JointWheel);
1347 } 1347 }
1348 } 1348 }
1349 1349
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 62ad2cd..fb142f5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -284,6 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
284 item.Name = itemUpd.Name; 284 item.Name = itemUpd.Name;
285 item.Description = itemUpd.Description; 285 item.Description = itemUpd.Description;
286 item.NextPermissions = itemUpd.NextPermissions; 286 item.NextPermissions = itemUpd.NextPermissions;
287 item.CurrentPermissions |= 8; // Slam!
287 item.EveryOnePermissions = itemUpd.EveryOnePermissions; 288 item.EveryOnePermissions = itemUpd.EveryOnePermissions;
288 289
289 // TODO: Requires sanity checks 290 // TODO: Requires sanity checks
@@ -347,7 +348,13 @@ namespace OpenSim.Region.Environment.Scenes
347 InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId); 348 InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId);
348 349
349 if (item != null) 350 if (item != null)
350 { 351 {
352 if (!ExternalChecks.ExternalChecksBypassPermissions())
353 {
354 if((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
355 return;
356 }
357
351 // TODO get recipient's root folder 358 // TODO get recipient's root folder
352 CachedUserInfo recipientUserInfo 359 CachedUserInfo recipientUserInfo
353 = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId); 360 = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId);
@@ -365,12 +372,37 @@ namespace OpenSim.Region.Environment.Scenes
365 itemCopy.AssetType = item.AssetType; 372 itemCopy.AssetType = item.AssetType;
366 itemCopy.InvType = item.InvType; 373 itemCopy.InvType = item.InvType;
367 itemCopy.Folder = recipientUserInfo.RootFolder.ID; 374 itemCopy.Folder = recipientUserInfo.RootFolder.ID;
368 itemCopy.CurrentPermissions = 2147483647; 375 if (ExternalChecks.ExternalChecksPropagatePermissions())
369 itemCopy.NextPermissions = 2147483647; 376 {
370 itemCopy.EveryOnePermissions = item.EveryOnePermissions; 377 if(item.InvType == 6)
371 itemCopy.BasePermissions = item.BasePermissions; 378 {
372 itemCopy.CurrentPermissions = item.CurrentPermissions; 379 itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
373 380 itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13;
381 }
382 else
383 {
384 Console.WriteLine("Non-Prim item ==>");
385 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions;
386 }
387
388 itemCopy.CurrentPermissions = itemCopy.BasePermissions;
389 if((item.CurrentPermissions & 8) != 0) // Propagate slam bit
390 {
391 itemCopy.CurrentPermissions = item.NextPermissions;
392 itemCopy.BasePermissions=itemCopy.CurrentPermissions;
393 itemCopy.CurrentPermissions |= 8;
394 }
395
396 itemCopy.NextPermissions = item.NextPermissions;
397 itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
398 }
399 else
400 {
401 itemCopy.CurrentPermissions = item.CurrentPermissions;
402 itemCopy.NextPermissions = item.NextPermissions;
403 itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
404 itemCopy.BasePermissions = item.BasePermissions;
405 }
374 itemCopy.GroupID = item.GroupID; 406 itemCopy.GroupID = item.GroupID;
375 itemCopy.GroupOwned = item.GroupOwned; 407 itemCopy.GroupOwned = item.GroupOwned;
376 itemCopy.Flags = item.Flags; 408 itemCopy.Flags = item.Flags;
@@ -379,6 +411,12 @@ namespace OpenSim.Region.Environment.Scenes
379 411
380 recipientUserInfo.AddItem(itemCopy); 412 recipientUserInfo.AddItem(itemCopy);
381 413
414 if (!ExternalChecks.ExternalChecksBypassPermissions())
415 {
416 if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
417 senderUserInfo.DeleteItem(itemId);
418 }
419
382 // Let the recipient client know about this new item 420 // Let the recipient client know about this new item
383 recipientClient.SendBulkUpdateInventory(itemCopy); 421 recipientClient.SendBulkUpdateInventory(itemCopy);
384 } 422 }
@@ -446,9 +484,16 @@ namespace OpenSim.Region.Environment.Scenes
446 484
447 if (asset != null) 485 if (asset != null)
448 { 486 {
449 // TODO: preserve current permissions? 487 if(remoteClient.AgentId == oldAgentID)
450 CreateNewInventoryItem( 488 {
451 remoteClient, newFolderID, callbackID, asset, item.NextPermissions); 489 CreateNewInventoryItem(
490 remoteClient, newFolderID, callbackID, asset, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions);
491 }
492 else
493 {
494 CreateNewInventoryItem(
495 remoteClient, newFolderID, callbackID, asset, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions);
496 }
452 } 497 }
453 else 498 else
454 { 499 {
@@ -507,7 +552,6 @@ namespace OpenSim.Region.Environment.Scenes
507 552
508 userInfo.DeleteItem(item.ID); 553 userInfo.DeleteItem(item.ID);
509 554
510 // TODO: preserve current permissions?
511 AddInventoryItem(remoteClient, item); 555 AddInventoryItem(remoteClient, item);
512 } 556 }
513 else 557 else
@@ -525,6 +569,12 @@ namespace OpenSim.Region.Environment.Scenes
525 } 569 }
526 } 570 }
527 571
572 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
573 AssetBase asset, uint nextOwnerMask)
574 {
575 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask, nextOwnerMask, 0, nextOwnerMask);
576 }
577
528 /// <summary> 578 /// <summary>
529 /// Create a new inventory item. 579 /// Create a new inventory item.
530 /// </summary> 580 /// </summary>
@@ -534,7 +584,7 @@ namespace OpenSim.Region.Environment.Scenes
534 /// <param name="asset"></param> 584 /// <param name="asset"></param>
535 /// <param name="nextOwnerMask"></param> 585 /// <param name="nextOwnerMask"></param>
536 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, 586 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
537 AssetBase asset, uint nextOwnerMask) 587 AssetBase asset, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask)
538 { 588 {
539 CachedUserInfo userInfo 589 CachedUserInfo userInfo
540 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 590 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
@@ -551,8 +601,10 @@ namespace OpenSim.Region.Environment.Scenes
551 item.AssetType = asset.Type; 601 item.AssetType = asset.Type;
552 item.InvType = asset.InvType; 602 item.InvType = asset.InvType;
553 item.Folder = folderID; 603 item.Folder = folderID;
554 item.CurrentPermissions = 2147483647; 604 item.CurrentPermissions = currentMask;
555 item.NextPermissions = nextOwnerMask; 605 item.NextPermissions = nextOwnerMask;
606 item.EveryOnePermissions = everyoneMask;
607 item.BasePermissions = baseMask;
556 608
557 userInfo.AddItem(item); 609 userInfo.AddItem(item);
558 remoteClient.SendInventoryItemCreateUpdate(item); 610 remoteClient.SendInventoryItemCreateUpdate(item);
@@ -766,9 +818,9 @@ namespace OpenSim.Region.Environment.Scenes
766 /// <param name="itemID"></param> 818 /// <param name="itemID"></param>
767 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) 819 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
768 { 820 {
769 SceneObjectGroup group = GetGroupByPrim(primLocalId); 821 SceneObjectPart part = GetSceneObjectPart(primLocalId);
770 822
771 if (null == group) 823 if (null == part)
772 { 824 {
773 m_log.WarnFormat( 825 m_log.WarnFormat(
774 "[PRIM INVENTORY]: " + 826 "[PRIM INVENTORY]: " +
@@ -778,7 +830,7 @@ namespace OpenSim.Region.Environment.Scenes
778 return; 830 return;
779 } 831 }
780 832
781 TaskInventoryItem taskItem = group.GetInventoryItem(primLocalId, itemId); 833 TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
782 834
783 if (null == taskItem) 835 if (null == taskItem)
784 { 836 {
@@ -786,19 +838,9 @@ namespace OpenSim.Region.Environment.Scenes
786 return; 838 return;
787 } 839 }
788 840
789// bool permission; 841 // Only owner can copy
790// permission = Permissions.CanCopyObject(remoteClient.AgentId,
791// ((SceneObjectGroup) selectedEnt).UUID);
792
793 // Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
794 // to copy
795 if (remoteClient.AgentId != taskItem.OwnerID) 842 if (remoteClient.AgentId != taskItem.OwnerID)
796 { 843 {
797 m_log.InfoFormat(
798 "[PRIM INVENTORY]: Attempt made by {0} {1} to copy inventory item {2} {3} in prim {4} {5},"
799 + " but temporarily not allowed pending upstream bugfixes/feature implementation",
800 remoteClient.Name, remoteClient.AgentId, taskItem.Name, taskItem.ItemID, group.Name, group.UUID);
801
802 return; 844 return;
803 } 845 }
804 846
@@ -813,22 +855,29 @@ namespace OpenSim.Region.Environment.Scenes
813 agentItem.AssetType = taskItem.Type; 855 agentItem.AssetType = taskItem.Type;
814 agentItem.InvType = taskItem.InvType; 856 agentItem.InvType = taskItem.InvType;
815 agentItem.Folder = folderId; 857 agentItem.Folder = folderId;
816 agentItem.EveryOnePermissions = taskItem.EveryoneMask;
817 858
818 if (remoteClient.AgentId != taskItem.OwnerID) 859 if ((remoteClient.AgentId != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
819 { 860 {
820 agentItem.BasePermissions = taskItem.NextOwnerMask; 861 agentItem.BasePermissions = taskItem.NextOwnerMask;
821 agentItem.CurrentPermissions = taskItem.NextOwnerMask; 862 agentItem.CurrentPermissions = taskItem.NextOwnerMask;
822 agentItem.NextPermissions = taskItem.NextOwnerMask; 863 agentItem.NextPermissions = taskItem.NextOwnerMask;
864 agentItem.EveryOnePermissions = taskItem.EveryoneMask & taskItem.NextOwnerMask;
823 } 865 }
824 else 866 else
825 { 867 {
826 agentItem.BasePermissions = taskItem.BaseMask; 868 agentItem.BasePermissions = taskItem.BaseMask;
827 agentItem.CurrentPermissions = taskItem.OwnerMask; 869 agentItem.CurrentPermissions = taskItem.OwnerMask;
828 agentItem.NextPermissions = taskItem.NextOwnerMask; 870 agentItem.NextPermissions = taskItem.NextOwnerMask;
871 agentItem.EveryOnePermissions = taskItem.EveryoneMask;
829 } 872 }
830 873
831 AddInventoryItem(remoteClient, agentItem); 874 AddInventoryItem(remoteClient, agentItem);
875 if (!ExternalChecks.ExternalChecksBypassPermissions())
876 {
877 if((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0)
878 part.RemoveInventoryItem(itemId);
879 }
880
832 } 881 }
833 882
834 /// <summary> 883 /// <summary>
@@ -842,9 +891,9 @@ namespace OpenSim.Region.Environment.Scenes
842 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, 891 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID,
843 uint primLocalID) 892 uint primLocalID)
844 { 893 {
845 SceneObjectGroup group = GetGroupByPrim(primLocalID); 894 SceneObjectPart part = GetSceneObjectPart(primLocalID);
846 895
847 if (group != null) 896 if (part != null)
848 { 897 {
849 LLUUID copyID = LLUUID.Random(); 898 LLUUID copyID = LLUUID.Random();
850 if (itemID != LLUUID.Zero) 899 if (itemID != LLUUID.Zero)
@@ -864,11 +913,16 @@ namespace OpenSim.Region.Environment.Scenes
864 913
865 if (item != null) 914 if (item != null)
866 { 915 {
867 group.AddInventoryItem(remoteClient, primLocalID, item, copyID); 916 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
868 m_log.InfoFormat( 917 m_log.InfoFormat(
869 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", 918 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
870 item.Name, primLocalID, remoteClient.Name); 919 item.Name, primLocalID, remoteClient.Name);
871 group.GetProperties(remoteClient); 920 part.ParentGroup.GetProperties(remoteClient);
921 if (!ExternalChecks.ExternalChecksBypassPermissions())
922 {
923 if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
924 RemoveInventoryItem(remoteClient, itemID);
925 }
872 } 926 }
873 else 927 else
874 { 928 {
@@ -915,12 +969,12 @@ namespace OpenSim.Region.Environment.Scenes
915 969
916 if (item != null) 970 if (item != null)
917 { 971 {
918 SceneObjectGroup group = GetGroupByPrim(localID); 972 SceneObjectPart part = GetSceneObjectPart(localID);
919 if (group != null) 973 if (part != null)
920 { 974 {
921 group.AddInventoryItem(remoteClient, localID, item, copyID); 975 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
922 group.StartScript(localID, copyID); 976 part.ParentGroup.StartScript(localID, copyID);
923 group.GetProperties(remoteClient); 977 part.ParentGroup.GetProperties(remoteClient);
924 978
925 // m_log.InfoFormat("[PRIMINVENTORY]: " + 979 // m_log.InfoFormat("[PRIMINVENTORY]: " +
926 // "Rezzed script {0} into prim local ID {1} for user {2}", 980 // "Rezzed script {0} into prim local ID {1} for user {2}",
@@ -959,7 +1013,7 @@ namespace OpenSim.Region.Environment.Scenes
959 /// <param name="packet"></param> 1013 /// <param name="packet"></param>
960 /// <param name="simClient"></param> 1014 /// <param name="simClient"></param>
961 public virtual void DeRezObject(Packet packet, IClientAPI remoteClient) 1015 public virtual void DeRezObject(Packet packet, IClientAPI remoteClient)
962 { 1016 {
963 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; 1017 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
964 1018
965 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 1019 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
@@ -1038,18 +1092,21 @@ namespace OpenSim.Region.Environment.Scenes
1038 item.AssetType = asset.Type; 1092 item.AssetType = asset.Type;
1039 item.InvType = asset.InvType; 1093 item.InvType = asset.InvType;
1040 item.Folder = DeRezPacket.AgentBlock.DestinationID; 1094 item.Folder = DeRezPacket.AgentBlock.DestinationID;
1041 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 1095 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1042 if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
1043 { 1096 {
1044 item.BasePermissions = objectGroup.RootPart.NextOwnerMask; 1097 objectGroup.ApplyNextOwnerPermissions();
1045 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; 1098
1046 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1099 item.BasePermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
1100 item.CurrentPermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
1101 item.NextPermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
1102 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
1047 } 1103 }
1048 else 1104 else
1049 { 1105 {
1050 item.BasePermissions = objectGroup.RootPart.BaseMask; 1106 item.BasePermissions = objectGroup.GetEffectivePermissions();
1051 item.CurrentPermissions = objectGroup.RootPart.OwnerMask; 1107 item.CurrentPermissions = objectGroup.GetEffectivePermissions();
1052 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1108 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1109 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
1053 } 1110 }
1054 1111
1055 // TODO: add the new fields (Flags, Sale info, etc) 1112 // TODO: add the new fields (Flags, Sale info, etc)
@@ -1068,6 +1125,7 @@ namespace OpenSim.Region.Environment.Scenes
1068 } 1125 }
1069 } 1126 }
1070 } 1127 }
1128
1071 public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID) 1129 public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
1072 { 1130 {
1073 SceneObjectGroup objectGroup = grp; 1131 SceneObjectGroup objectGroup = grp;
@@ -1130,19 +1188,20 @@ namespace OpenSim.Region.Environment.Scenes
1130 // Sticking it in root folder for now.. objects folder later? 1188 // Sticking it in root folder for now.. objects folder later?
1131 1189
1132 item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID; 1190 item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID;
1133 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 1191 if ((agentID != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1134 if (agentID != objectGroup.RootPart.OwnerID)
1135 { 1192 {
1136 item.BasePermissions = objectGroup.RootPart.NextOwnerMask; 1193 item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
1137 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; 1194 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
1138 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1195 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1196 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
1139 } 1197 }
1140 else 1198 else
1141 { 1199 {
1142 item.BasePermissions = objectGroup.RootPart.BaseMask; 1200 item.BasePermissions = objectGroup.GetEffectivePermissions();
1143 item.CurrentPermissions = objectGroup.RootPart.OwnerMask; 1201 item.CurrentPermissions = objectGroup.GetEffectivePermissions();
1144 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1202 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1145 } 1203 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
1204 }
1146 1205
1147 userInfo.AddItem(item); 1206 userInfo.AddItem(item);
1148 1207
@@ -1187,18 +1246,19 @@ namespace OpenSim.Region.Environment.Scenes
1187 // Sticking it in root folder for now.. objects folder later? 1246 // Sticking it in root folder for now.. objects folder later?
1188 1247
1189 item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID; 1248 item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID;
1190 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 1249 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1191 if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
1192 { 1250 {
1193 item.BasePermissions = objectGroup.RootPart.NextOwnerMask; 1251 item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
1194 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; 1252 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
1195 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1253 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1254 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
1196 } 1255 }
1197 else 1256 else
1198 { 1257 {
1199 item.BasePermissions = objectGroup.RootPart.BaseMask; 1258 item.BasePermissions = objectGroup.RootPart.BaseMask;
1200 item.CurrentPermissions = objectGroup.RootPart.OwnerMask; 1259 item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
1201 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1260 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1261 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
1202 } 1262 }
1203 1263
1204 userInfo.AddItem(item); 1264 userInfo.AddItem(item);
@@ -1344,18 +1404,33 @@ namespace OpenSim.Region.Environment.Scenes
1344 rootPart.Description = item.Description; 1404 rootPart.Description = item.Description;
1345 1405
1346 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 1406 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
1407
1408 if(rootPart.OwnerID != item.Owner)
1409 {
1410 if((item.CurrentPermissions & 8) != 0)
1411 {
1412 foreach (SceneObjectPart part in partList)
1413 {
1414 part.EveryoneMask = item.EveryOnePermissions;
1415 part.NextOwnerMask = item.NextPermissions;
1416 }
1417 }
1418 group.ApplyNextOwnerPermissions();
1419 }
1420
1347 foreach (SceneObjectPart part in partList) 1421 foreach (SceneObjectPart part in partList)
1348 { 1422 {
1349 if (part.OwnerID != item.Owner) 1423 if (part.OwnerID != item.Owner)
1350 { 1424 {
1351 part.LastOwnerID = part.OwnerID; 1425 part.LastOwnerID = part.OwnerID;
1352 part.OwnerID = item.Owner; 1426 part.OwnerID = item.Owner;
1353 part.EveryoneMask = item.EveryOnePermissions;
1354 part.BaseMask = item.BasePermissions;
1355 part.OwnerMask = item.CurrentPermissions;
1356 part.NextOwnerMask = item.NextPermissions;
1357 part.ChangeInventoryOwner(item.Owner); 1427 part.ChangeInventoryOwner(item.Owner);
1358 } 1428 }
1429 else if(((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
1430 {
1431 part.EveryoneMask = item.EveryOnePermissions;
1432 part.NextOwnerMask = item.NextPermissions;
1433 }
1359 } 1434 }
1360 1435
1361 rootPart.TrimPermissions(); 1436 rootPart.TrimPermissions();
@@ -1421,18 +1496,33 @@ namespace OpenSim.Region.Environment.Scenes
1421 rootPart.Description = item.Description; 1496 rootPart.Description = item.Description;
1422 1497
1423 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 1498 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
1499
1500 if(rootPart.OwnerID != item.OwnerID)
1501 {
1502 if((item.OwnerMask & 8) != 0)
1503 {
1504 foreach (SceneObjectPart part in partList)
1505 {
1506 part.EveryoneMask = item.EveryoneMask;
1507 part.NextOwnerMask = item.NextOwnerMask;
1508 }
1509 }
1510 group.ApplyNextOwnerPermissions();
1511 }
1512
1424 foreach (SceneObjectPart part in partList) 1513 foreach (SceneObjectPart part in partList)
1425 { 1514 {
1426 if (part.OwnerID != item.OwnerID) 1515 if (part.OwnerID != item.OwnerID)
1427 { 1516 {
1428 part.LastOwnerID = part.OwnerID; 1517 part.LastOwnerID = part.OwnerID;
1429 part.OwnerID = item.OwnerID; 1518 part.OwnerID = item.OwnerID;
1430 part.EveryoneMask = item.EveryoneMask;
1431 part.BaseMask = item.BaseMask;
1432 part.OwnerMask = item.OwnerMask;
1433 part.NextOwnerMask = item.NextOwnerMask;
1434 part.ChangeInventoryOwner(item.OwnerID); 1519 part.ChangeInventoryOwner(item.OwnerID);
1435 } 1520 }
1521 else if((item.OwnerMask & 8) != 0) // Slam!
1522 {
1523 part.EveryoneMask = item.EveryoneMask;
1524 part.NextOwnerMask = item.NextOwnerMask;
1525 }
1436 } 1526 }
1437 rootPart.TrimPermissions(); 1527 rootPart.TrimPermissions();
1438 if (group.RootPart.Shape.PCode == (byte)PCode.Prim) 1528 if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index fcc6c75..645c302 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -61,7 +61,16 @@ namespace OpenSim.Region.Environment.Scenes
61 61
62 public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID) 62 public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID)
63 { 63 {
64 uint perms=(uint)2147483647; 64 SceneObjectPart part=m_scene.GetSceneObjectPart(objectID);
65
66 uint perms=part.GetEffectiveObjectFlags() |
67 (uint)LLObject.ObjectFlags.ObjectModify |
68 (uint)LLObject.ObjectFlags.ObjectCopy |
69 (uint)LLObject.ObjectFlags.ObjectMove |
70 (uint)LLObject.ObjectFlags.ObjectTransfer |
71 (uint)LLObject.ObjectFlags.ObjectYouOwner |
72 (uint)LLObject.ObjectFlags.ObjectYouOfficer;
73
65 foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions) 74 foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions)
66 { 75 {
67 perms &= check(userID, objectID); 76 perms &= check(userID, objectID);
@@ -117,6 +126,32 @@ namespace OpenSim.Region.Environment.Scenes
117 return true; 126 return true;
118 } 127 }
119 128
129 public delegate bool PropagatePermissions();
130 private List<PropagatePermissions> PropagatePermissionsCheckFunctions = new List<PropagatePermissions>();
131
132 public void addPropagatePermissions(PropagatePermissions delegateFunc)
133 {
134 if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
135 PropagatePermissionsCheckFunctions.Add(delegateFunc);
136 }
137 public void removePropagatePermissions(PropagatePermissions delegateFunc)
138 {
139 if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
140 PropagatePermissionsCheckFunctions.Remove(delegateFunc);
141 }
142
143 public bool ExternalChecksPropagatePermissions()
144 {
145 foreach (PropagatePermissions check in PropagatePermissionsCheckFunctions)
146 {
147 if (check() == false)
148 {
149 return false;
150 }
151 }
152 return true;
153 }
154
120 #region REZ OBJECT 155 #region REZ OBJECT
121 public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); 156 public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
122 private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); 157 private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 721680f..8a7096f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Reflection; 29using System.Reflection;
29using libsecondlife; 30using libsecondlife;
30using log4net; 31using log4net;
@@ -282,5 +283,38 @@ namespace OpenSim.Region.Environment.Scenes
282 283
283 return -1; 284 return -1;
284 } 285 }
286
287 public uint GetEffectivePermissions()
288 {
289 uint perms=(uint)(PermissionMask.Modify |
290 PermissionMask.Copy |
291 PermissionMask.Move |
292 PermissionMask.Transfer) | 7;
293
294 foreach (SceneObjectPart part in m_parts.Values)
295 perms &= part.MaskEffectivePermissions();
296
297 if((RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
298 perms &= ~(uint)PermissionMask.Modify;
299 if((RootPart.OwnerMask & (uint)PermissionMask.Copy) == 0)
300 perms &= ~(uint)PermissionMask.Copy;
301 if((RootPart.OwnerMask & (uint)PermissionMask.Transfer) == 0)
302 perms &= ~(uint)PermissionMask.Transfer;
303
304 if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
305 perms &= ~((uint)PermissionMask.Modify >> 13);
306 if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
307 perms &= ~((uint)PermissionMask.Copy >> 13);
308 if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
309 perms &= ~((uint)PermissionMask.Transfer >> 13);
310
311 return perms;
312 }
313
314 public void ApplyNextOwnerPermissions()
315 {
316 foreach (SceneObjectPart part in m_parts.Values)
317 part.ApplyNextOwnerPermissions();
318 }
285 } 319 }
286} 320}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 3ec6ed8..14bfde0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1352,7 +1352,7 @@ namespace OpenSim.Region.Environment.Scenes
1352 { 1352 {
1353 // Apply Next Owner Permissions if we're not bypassing permissions 1353 // Apply Next Owner Permissions if we're not bypassing permissions
1354 if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions()) 1354 if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions())
1355 m_rootPart.ApplyNextOwnerPermissions(); 1355 ApplyNextOwnerPermissions();
1356 } 1356 }
1357 1357
1358 part.ScheduleFullUpdate(); 1358 part.ScheduleFullUpdate();
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}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index c171e78..0196b91 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -813,11 +813,9 @@ namespace OpenSim.Region.Environment.Scenes
813 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 813 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
814 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 814 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
815 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log 815 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
816 m_folderID = UUID;
817 816
818 Flags = 0; 817 Flags = 0;
819 Flags |= LLObject.ObjectFlags.AllowInventoryDrop | 818 Flags |= LLObject.ObjectFlags.CreateSelected;
820 LLObject.ObjectFlags.CreateSelected;
821 819
822 TrimPermissions(); 820 TrimPermissions();
823 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); 821 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
@@ -877,9 +875,10 @@ namespace OpenSim.Region.Environment.Scenes
877 /// <returns></returns> 875 /// <returns></returns>
878 public static SceneObjectPart FromXml(XmlReader xmlReader) 876 public static SceneObjectPart FromXml(XmlReader xmlReader)
879 { 877 {
878 // It's not necessary to persist this
879
880 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); 880 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
881 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); 881 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
882
883 return newobject; 882 return newobject;
884 } 883 }
885 884
@@ -913,15 +912,6 @@ namespace OpenSim.Region.Environment.Scenes
913 } 912 }
914 } 913 }
915 914
916 public void ApplyNextOwnerPermissions()
917 {
918 BaseMask = NextOwnerMask;
919 OwnerMask = NextOwnerMask;
920
921 TriggerScriptChangedEvent(Changed.OWNER);
922
923 }
924
925 public void TrimPermissions() 915 public void TrimPermissions()
926 { 916 {
927 917
@@ -2541,7 +2531,7 @@ namespace OpenSim.Region.Environment.Scenes
2541 } 2531 }
2542 2532
2543 info.AddValue("m_inventoryFileName", m_inventoryFileName); 2533 info.AddValue("m_inventoryFileName", m_inventoryFileName);
2544 info.AddValue("m_folderID", m_folderID.UUID); 2534 info.AddValue("m_folderID", UUID);
2545 info.AddValue("PhysActor", PhysActor); 2535 info.AddValue("PhysActor", PhysActor);
2546 2536
2547 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); 2537 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();