diff options
author | Melanie | 2011-12-27 14:04:49 +0100 |
---|---|---|
committer | Melanie | 2011-12-27 14:04:49 +0100 |
commit | bf4d727cd596415431a35272e21c68190d9b5374 (patch) | |
tree | a9b3280a411d4c9fe6875992896561ce05e197c3 /OpenSim | |
parent | Remove a debug spam (diff) | |
download | opensim-SC_OLD-bf4d727cd596415431a35272e21c68190d9b5374.zip opensim-SC_OLD-bf4d727cd596415431a35272e21c68190d9b5374.tar.gz opensim-SC_OLD-bf4d727cd596415431a35272e21c68190d9b5374.tar.bz2 opensim-SC_OLD-bf4d727cd596415431a35272e21c68190d9b5374.tar.xz |
Fix permissions being lost and correct slam behavior, removing icompatible
code inherited from core and dead code.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 158 |
1 files changed, 72 insertions, 86 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 12555b7..7ebf002 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -476,8 +476,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
476 | IClientAPI remoteClient) | 476 | IClientAPI remoteClient) |
477 | { | 477 | { |
478 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 478 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
479 | // For the porposes of inventory, an object is modify if the prims | ||
480 | // are modify. This allows renaming an object that contains no | ||
481 | // mod items. | ||
479 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 482 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
480 | effectivePerms &= grp.GetEffectivePermissions(true); | 483 | { |
484 | uint groupPerms = grp.GetEffectivePermissions(true); | ||
485 | if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
486 | groupPerms |= (uint)PermissionMask.Modify; | ||
487 | |||
488 | effectivePerms &= groupPerms; | ||
489 | } | ||
481 | effectivePerms |= (uint)PermissionMask.Move; | 490 | effectivePerms |= (uint)PermissionMask.Move; |
482 | 491 | ||
483 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 492 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
@@ -644,7 +653,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
644 | if (so.RootPart.FromFolderID != UUID.Zero) | 653 | if (so.RootPart.FromFolderID != UUID.Zero) |
645 | { | 654 | { |
646 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | 655 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); |
647 | folder = m_Scene.InventoryService.GetFolder(f); | 656 | if (f != null) |
657 | folder = m_Scene.InventoryService.GetFolder(f); | ||
648 | } | 658 | } |
649 | } | 659 | } |
650 | 660 | ||
@@ -683,12 +693,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
683 | return null; | 693 | return null; |
684 | } | 694 | } |
685 | 695 | ||
686 | |||
687 | |||
688 | |||
689 | |||
690 | |||
691 | |||
692 | item.Owner = remoteClient.AgentId; | 696 | item.Owner = remoteClient.AgentId; |
693 | 697 | ||
694 | return RezObject( | 698 | return RezObject( |
@@ -784,8 +788,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
784 | } | 788 | } |
785 | } | 789 | } |
786 | 790 | ||
791 | int primcount = 0; | ||
792 | foreach (SceneObjectGroup g in objlist) | ||
793 | primcount += g.PrimCount; | ||
794 | |||
795 | if (!m_Scene.Permissions.CanRezObject( | ||
796 | primcount, remoteClient.AgentId, pos) | ||
797 | && !attachment) | ||
798 | { | ||
799 | // The client operates in no fail mode. It will | ||
800 | // have already removed the item from the folder | ||
801 | // if it's no copy. | ||
802 | // Put it back if it's not an attachment | ||
803 | // | ||
804 | if (item != null) | ||
805 | { | ||
806 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
807 | remoteClient.SendBulkUpdateInventory(item); | ||
808 | } | ||
809 | |||
810 | return null; | ||
811 | } | ||
812 | |||
787 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 813 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
788 | return null; | 814 | return null; |
815 | |||
789 | for (int i = 0; i < objlist.Count; i++) | 816 | for (int i = 0; i < objlist.Count; i++) |
790 | { | 817 | { |
791 | group = objlist[i]; | 818 | group = objlist[i]; |
@@ -853,48 +880,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
853 | 880 | ||
854 | rootPart.ScheduleFullUpdate(); | 881 | rootPart.ScheduleFullUpdate(); |
855 | } | 882 | } |
856 | |||
857 | if ((rootPart.OwnerID != item.Owner) || | ||
858 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
859 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
860 | { | ||
861 | //Need to kill the for sale here | ||
862 | rootPart.ObjectSaleType = 0; | ||
863 | rootPart.SalePrice = 10; | ||
864 | |||
865 | if (m_Scene.Permissions.PropagatePermissions()) | ||
866 | { | ||
867 | foreach (SceneObjectPart part in group.Parts) | ||
868 | { | ||
869 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
870 | { | ||
871 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
872 | part.EveryoneMask = item.EveryOnePermissions; | ||
873 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
874 | part.NextOwnerMask = item.NextPermissions; | ||
875 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
876 | part.GroupMask = item.GroupPermissions; | ||
877 | } | ||
878 | } | ||
879 | |||
880 | foreach (SceneObjectPart part in group.Parts) | ||
881 | { | ||
882 | part.LastOwnerID = part.OwnerID; | ||
883 | part.OwnerID = item.Owner; | ||
884 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
885 | } | ||
886 | |||
887 | group.ApplyNextOwnerPermissions(); | ||
888 | } | ||
889 | } | ||
890 | |||
891 | // m_log.DebugFormat( | ||
892 | // "[InventoryAccessModule]: Rezzed {0} {1} {2} for {3}", | ||
893 | // group.Name, group.LocalId, group.UUID, remoteClient.Name); | ||
894 | } | 883 | } |
895 | 884 | ||
896 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 885 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
897 | // TODO: Remove the magic number badness | 886 | |
898 | if (item != null) | 887 | if (item != null) |
899 | DoPostRezWhenFromItem(item, attachment); | 888 | DoPostRezWhenFromItem(item, attachment); |
900 | 889 | ||
@@ -934,25 +923,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
934 | } | 923 | } |
935 | } | 924 | } |
936 | 925 | ||
937 | int primcount = 0; | ||
938 | foreach (SceneObjectGroup g in objlist) | ||
939 | primcount += g.PrimCount; | ||
940 | |||
941 | if (!m_Scene.Permissions.CanRezObject( | ||
942 | primcount, remoteClient.AgentId, pos) | ||
943 | && !isAttachment) | ||
944 | { | ||
945 | // The client operates in no fail mode. It will | ||
946 | // have already removed the item from the folder | ||
947 | // if it's no copy. | ||
948 | // Put it back if it's not an attachment | ||
949 | // | ||
950 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!isAttachment)) | ||
951 | remoteClient.SendBulkUpdateInventory(item); | ||
952 | |||
953 | return false; | ||
954 | } | ||
955 | |||
956 | for (int i = 0; i < objlist.Count; i++) | 926 | for (int i = 0; i < objlist.Count; i++) |
957 | { | 927 | { |
958 | SceneObjectGroup so = objlist[i]; | 928 | SceneObjectGroup so = objlist[i]; |
@@ -968,14 +938,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
968 | { | 938 | { |
969 | rootPart.Name = item.Name; | 939 | rootPart.Name = item.Name; |
970 | rootPart.Description = item.Description; | 940 | rootPart.Description = item.Description; |
971 | rootPart.ObjectSaleType = item.SaleType; | 941 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) |
972 | rootPart.SalePrice = item.SalePrice; | 942 | { |
943 | rootPart.ObjectSaleType = item.SaleType; | ||
944 | rootPart.SalePrice = item.SalePrice; | ||
945 | } | ||
973 | } | 946 | } |
974 | 947 | ||
975 | rootPart.FromFolderID = item.Folder; | 948 | rootPart.FromFolderID = item.Folder; |
976 | 949 | ||
977 | if ((rootPart.OwnerID != item.Owner) || | 950 | if ((rootPart.OwnerID != item.Owner) || |
978 | (item.CurrentPermissions & 16) != 0) | 951 | (item.CurrentPermissions & 16) != 0 || |
952 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
979 | { | 953 | { |
980 | //Need to kill the for sale here | 954 | //Need to kill the for sale here |
981 | rootPart.ObjectSaleType = 0; | 955 | rootPart.ObjectSaleType = 0; |
@@ -985,31 +959,43 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
985 | { | 959 | { |
986 | foreach (SceneObjectPart part in so.Parts) | 960 | foreach (SceneObjectPart part in so.Parts) |
987 | { | 961 | { |
988 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
989 | { | ||
990 | part.EveryoneMask = item.EveryOnePermissions; | ||
991 | part.NextOwnerMask = item.NextPermissions; | ||
992 | } | ||
993 | part.GroupMask = 0; // DO NOT propagate here | 962 | part.GroupMask = 0; // DO NOT propagate here |
963 | |||
964 | part.LastOwnerID = part.OwnerID; | ||
965 | part.OwnerID = item.Owner; | ||
966 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
994 | } | 967 | } |
995 | 968 | ||
996 | so.ApplyNextOwnerPermissions(); | 969 | so.ApplyNextOwnerPermissions(); |
970 | |||
971 | // In case the user has changed flags on a received item | ||
972 | // we have to apply those changes after the slam. Else we | ||
973 | // get a net loss of permissions | ||
974 | foreach (SceneObjectPart part in so.Parts) | ||
975 | { | ||
976 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
977 | { | ||
978 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
979 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; | ||
980 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
981 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; | ||
982 | } | ||
983 | } | ||
997 | } | 984 | } |
998 | } | 985 | } |
999 | 986 | else | |
1000 | foreach (SceneObjectPart part in so.Parts) | ||
1001 | { | 987 | { |
1002 | part.FromUserInventoryItemID = fromUserInventoryItemId; | 988 | foreach (SceneObjectPart part in so.Parts) |
1003 | |||
1004 | if ((part.OwnerID != item.Owner) || | ||
1005 | (item.CurrentPermissions & 16) != 0) | ||
1006 | { | 989 | { |
1007 | part.Inventory.ChangeInventoryOwner(item.Owner); | 990 | part.FromUserInventoryItemID = fromUserInventoryItemId; |
1008 | part.GroupMask = 0; // DO NOT propagate here | 991 | |
992 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
993 | part.EveryoneMask = item.EveryOnePermissions; | ||
994 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
995 | part.NextOwnerMask = item.NextPermissions; | ||
996 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
997 | part.GroupMask = item.GroupPermissions; | ||
1009 | } | 998 | } |
1010 | |||
1011 | part.EveryoneMask = item.EveryOnePermissions; | ||
1012 | part.NextOwnerMask = item.NextPermissions; | ||
1013 | } | 999 | } |
1014 | 1000 | ||
1015 | rootPart.TrimPermissions(); | 1001 | rootPart.TrimPermissions(); |