diff options
author | Melanie Thielker | 2008-09-22 22:33:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-22 22:33:00 +0000 |
commit | 48672c7fd601ca2462ea91c4c09928c3a668e640 (patch) | |
tree | 33c9989e79250ba81ece613d541408fd4cb2c633 | |
parent | * Remove some old libsecondlife workarounds as suggested by jhurliman in http... (diff) | |
download | opensim-SC-48672c7fd601ca2462ea91c4c09928c3a668e640.zip opensim-SC-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.gz opensim-SC-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.bz2 opensim-SC-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.xz |
Move script and notecard open perms checks from ClientView to the
perms module
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | 129 |
2 files changed, 149 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c649493..6915b3a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4835,6 +4835,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4835 | case PacketType.TransferRequest: | 4835 | case PacketType.TransferRequest: |
4836 | //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); | 4836 | //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); |
4837 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | 4837 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; |
4838 | System.Console.WriteLine("Transfer request, source {0}", transfer.TransferInfo.SourceType); | ||
4838 | // Validate inventory transfers | 4839 | // Validate inventory transfers |
4839 | // Has to be done here, because AssetCache can't do it | 4840 | // Has to be done here, because AssetCache can't do it |
4840 | // | 4841 | // |
@@ -4890,8 +4891,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4890 | return; | 4891 | return; |
4891 | } | 4892 | } |
4892 | 4893 | ||
4893 | if ((assetRequestItem.CurrentPermissions & ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | 4894 | // At this point, we need to apply perms |
4894 | break; | 4895 | // only to notecards and scripts. All |
4896 | // other asset types are always available | ||
4897 | // | ||
4898 | if (assetRequestItem.AssetType == 10) | ||
4899 | { | ||
4900 | if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewScript(itemID, UUID.Zero, AgentId)) | ||
4901 | { | ||
4902 | SendAgentAlertMessage("Insufficient permissions to view script", false); | ||
4903 | break; | ||
4904 | } | ||
4905 | } | ||
4906 | else if (assetRequestItem.AssetType == 7) | ||
4907 | { | ||
4908 | if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewNotecard(itemID, UUID.Zero, AgentId)) | ||
4909 | { | ||
4910 | SendAgentAlertMessage("Insufficient permissions to view notecard", false); | ||
4911 | break; | ||
4912 | } | ||
4913 | } | ||
4914 | |||
4895 | if (assetRequestItem.AssetID != requestID) | 4915 | if (assetRequestItem.AssetID != requestID) |
4896 | break; | 4916 | break; |
4897 | } | 4917 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 7b940f5..ff5ba18 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -952,7 +952,77 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
952 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 952 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
953 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 953 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
954 | 954 | ||
955 | return false; | 955 | if (objectID == UUID.Zero) // User inventory |
956 | { | ||
957 | CachedUserInfo userInfo = | ||
958 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | ||
959 | if (userInfo == null) | ||
960 | return false; | ||
961 | |||
962 | if (userInfo.RootFolder == null) | ||
963 | return false; | ||
964 | |||
965 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script); | ||
966 | if (assetRequestItem == null) // Library item | ||
967 | { | ||
968 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); | ||
969 | |||
970 | if (assetRequestItem != null) // Implicitly readable | ||
971 | return true; | ||
972 | } | ||
973 | |||
974 | // SL is rather harebrained here. In SL, a script you | ||
975 | // have mod/copy no trans is readable. This subverts | ||
976 | // permissions, but is used in some products, most | ||
977 | // notably Hippo door plugin and HippoRent 5 networked | ||
978 | // prim counter. | ||
979 | // To enable this broken SL-ism, remove Transfer from | ||
980 | // the below expressions. | ||
981 | // Trying to improve on SL perms by making a script | ||
982 | // readable only if it's really full perms | ||
983 | // | ||
984 | if ((assetRequestItem.CurrentPermissions & | ||
985 | ((uint)PermissionMask.Modify | | ||
986 | (uint)PermissionMask.Copy | | ||
987 | (uint)PermissionMask.Transfer)) != | ||
988 | ((uint)PermissionMask.Modify | | ||
989 | (uint)PermissionMask.Copy | | ||
990 | (uint)PermissionMask.Transfer)) | ||
991 | return false; | ||
992 | } | ||
993 | else // Prim inventory | ||
994 | { | ||
995 | SceneObjectPart part = scene.GetSceneObjectPart(objectID); | ||
996 | |||
997 | if (part == null) | ||
998 | return false; | ||
999 | |||
1000 | if (part.OwnerID != user) | ||
1001 | return false; | ||
1002 | |||
1003 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
1004 | return false; | ||
1005 | |||
1006 | TaskInventoryItem ti = part.GetInventoryItem(script); | ||
1007 | |||
1008 | if (ti == null) | ||
1009 | return false; | ||
1010 | |||
1011 | if (ti.OwnerID != user) | ||
1012 | return false; | ||
1013 | |||
1014 | // Require full perms | ||
1015 | if ((ti.CurrentPermissions & | ||
1016 | ((uint)PermissionMask.Modify | | ||
1017 | (uint)PermissionMask.Copy | | ||
1018 | (uint)PermissionMask.Transfer)) != | ||
1019 | ((uint)PermissionMask.Modify | | ||
1020 | (uint)PermissionMask.Copy | | ||
1021 | (uint)PermissionMask.Transfer)) | ||
1022 | return false; | ||
1023 | } | ||
1024 | |||
1025 | return true; | ||
956 | } | 1026 | } |
957 | 1027 | ||
958 | private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) | 1028 | private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) |
@@ -960,7 +1030,62 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
960 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1030 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
961 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1031 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
962 | 1032 | ||
963 | return false; | 1033 | if (objectID == UUID.Zero) // User inventory |
1034 | { | ||
1035 | CachedUserInfo userInfo = | ||
1036 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | ||
1037 | if (userInfo == null) | ||
1038 | return false; | ||
1039 | |||
1040 | if (userInfo.RootFolder == null) | ||
1041 | return false; | ||
1042 | |||
1043 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard); | ||
1044 | if (assetRequestItem == null) // Library item | ||
1045 | { | ||
1046 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | ||
1047 | |||
1048 | if (assetRequestItem != null) // Implicitly readable | ||
1049 | return true; | ||
1050 | } | ||
1051 | |||
1052 | // Notecards are always readable unless no copy | ||
1053 | // | ||
1054 | if ((assetRequestItem.CurrentPermissions & | ||
1055 | (uint)PermissionMask.Copy) != | ||
1056 | (uint)PermissionMask.Copy) | ||
1057 | return false; | ||
1058 | } | ||
1059 | else // Prim inventory | ||
1060 | { | ||
1061 | SceneObjectPart part = scene.GetSceneObjectPart(objectID); | ||
1062 | |||
1063 | if (part == null) | ||
1064 | return false; | ||
1065 | |||
1066 | if (part.OwnerID != user) | ||
1067 | return false; | ||
1068 | |||
1069 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
1070 | return false; | ||
1071 | |||
1072 | TaskInventoryItem ti = part.GetInventoryItem(notecard); | ||
1073 | |||
1074 | if (ti == null) | ||
1075 | return false; | ||
1076 | |||
1077 | if (ti.OwnerID != user) | ||
1078 | return false; | ||
1079 | |||
1080 | // Notecards are always readable unless no copy | ||
1081 | // | ||
1082 | if ((ti.CurrentPermissions & | ||
1083 | (uint)PermissionMask.Copy) != | ||
1084 | (uint)PermissionMask.Copy) | ||
1085 | return false; | ||
1086 | } | ||
1087 | |||
1088 | return true; | ||
964 | } | 1089 | } |
965 | 1090 | ||
966 | #endregion | 1091 | #endregion |