diff options
author | Adam Frisby | 2008-04-23 13:22:06 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-23 13:22:06 +0000 |
commit | e456cb7533dff72aa22a87f261a758e294e707b1 (patch) | |
tree | 8cc321c8b4438acd298bb756768ba124feb09661 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |
parent | * Patch #1026 - llDialog support -- Thanks Melanie! (diff) | |
download | opensim-SC_OLD-e456cb7533dff72aa22a87f261a758e294e707b1.zip opensim-SC_OLD-e456cb7533dff72aa22a87f261a758e294e707b1.tar.gz opensim-SC_OLD-e456cb7533dff72aa22a87f261a758e294e707b1.tar.bz2 opensim-SC_OLD-e456cb7533dff72aa22a87f261a758e294e707b1.tar.xz |
* Patch for #973 - Object Rez from Inventory ignores permissions - Thanks tglion!
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index e4a9551..9bf6728 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -855,9 +855,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
855 | } | 855 | } |
856 | if (selectedEnt != null) | 856 | if (selectedEnt != null) |
857 | { | 857 | { |
858 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) | 858 | bool permission; |
859 | if (DeRezPacket.AgentBlock.Destination == 1) | ||
860 | { // Take Copy | ||
861 | permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId, | ||
862 | ((SceneObjectGroup) selectedEnt).UUID); | ||
863 | } | ||
864 | else | ||
865 | { // Take | ||
866 | permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId, | ||
867 | ((SceneObjectGroup) selectedEnt).UUID); | ||
868 | } | ||
869 | |||
870 | if (permission) | ||
859 | { | 871 | { |
860 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); | 872 | SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; |
873 | string sceneObjectXml = objectGroup.ToXmlString(); | ||
874 | |||
861 | CachedUserInfo userInfo = | 875 | CachedUserInfo userInfo = |
862 | CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 876 | CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
863 | if (userInfo != null) | 877 | if (userInfo != null) |
@@ -871,8 +885,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
871 | AssetCache.AddAsset(asset); | 885 | AssetCache.AddAsset(asset); |
872 | 886 | ||
873 | InventoryItemBase item = new InventoryItemBase(); | 887 | InventoryItemBase item = new InventoryItemBase(); |
888 | item.Creator = objectGroup.RootPart.CreatorID; | ||
874 | item.Owner = remoteClient.AgentId; | 889 | item.Owner = remoteClient.AgentId; |
875 | item.Creator = remoteClient.AgentId; | ||
876 | item.ID = LLUUID.Random(); | 890 | item.ID = LLUUID.Random(); |
877 | item.AssetID = asset.FullID; | 891 | item.AssetID = asset.FullID; |
878 | item.Description = asset.Description; | 892 | item.Description = asset.Description; |
@@ -880,12 +894,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
880 | item.AssetType = asset.Type; | 894 | item.AssetType = asset.Type; |
881 | item.InvType = asset.InvType; | 895 | item.InvType = asset.InvType; |
882 | item.Folder = DeRezPacket.AgentBlock.DestinationID; | 896 | item.Folder = DeRezPacket.AgentBlock.DestinationID; |
883 | item.CurrentPermissions = 2147483647; | 897 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; |
884 | item.NextPermissions = 2147483647; | 898 | if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) { |
885 | item.EveryOnePermissions = | 899 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; |
886 | ((SceneObjectGroup) selectedEnt).RootPart.EveryoneMask; | 900 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; |
887 | item.BasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask; | 901 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
888 | item.CurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask; | 902 | } |
903 | else | ||
904 | { | ||
905 | item.BasePermissions = objectGroup.RootPart.BaseMask; | ||
906 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; | ||
907 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
908 | } | ||
889 | 909 | ||
890 | userInfo.AddItem(remoteClient.AgentId, item); | 910 | userInfo.AddItem(remoteClient.AgentId, item); |
891 | remoteClient.SendInventoryItemCreateUpdate(item); | 911 | remoteClient.SendInventoryItemCreateUpdate(item); |
@@ -894,7 +914,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
894 | // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy | 914 | // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy |
895 | if (DeRezPacket.AgentBlock.Destination != 1) | 915 | if (DeRezPacket.AgentBlock.Destination != 1) |
896 | { | 916 | { |
897 | DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt); | 917 | DeleteSceneObjectGroup(objectGroup); |
898 | } | 918 | } |
899 | } | 919 | } |
900 | } | 920 | } |
@@ -941,6 +961,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
941 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), | 961 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
942 | BypassRayCast, bRayEndIsIntersection); | 962 | BypassRayCast, bRayEndIsIntersection); |
943 | 963 | ||
964 | if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos)) | ||
965 | { | ||
966 | return; | ||
967 | } | ||
968 | |||
944 | // Rez object | 969 | // Rez object |
945 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 970 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
946 | if (userInfo != null) | 971 | if (userInfo != null) |
@@ -966,7 +991,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
966 | // object itself before we rez. | 991 | // object itself before we rez. |
967 | rootPart.Name = item.Name; | 992 | rootPart.Name = item.Name; |
968 | rootPart.Description = item.Description; | 993 | rootPart.Description = item.Description; |
969 | 994 | ||
995 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
996 | foreach (SceneObjectPart part in partList) | ||
997 | { | ||
998 | if (part.OwnerID != item.Owner) | ||
999 | { | ||
1000 | part.LastOwnerID = part.OwnerID; | ||
1001 | part.OwnerID = item.Owner; | ||
1002 | part.EveryoneMask = item.EveryOnePermissions; | ||
1003 | part.BaseMask = item.BasePermissions; | ||
1004 | part.OwnerMask = item.CurrentPermissions; | ||
1005 | part.NextOwnerMask = item.NextPermissions; | ||
1006 | part.ChangeInventoryOwner(item.Owner); | ||
1007 | } | ||
1008 | } | ||
1009 | |||
970 | rootPart.TrimPermissions(); | 1010 | rootPart.TrimPermissions(); |
971 | group.ApplyPhysics(m_physicalPrim); | 1011 | group.ApplyPhysics(m_physicalPrim); |
972 | group.StartScripts(); | 1012 | group.StartScripts(); |