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 /OpenSim/Region/Environment/Modules/World | |
parent | * Remove some old libsecondlife workarounds as suggested by jhurliman in http... (diff) | |
download | opensim-SC_OLD-48672c7fd601ca2462ea91c4c09928c3a668e640.zip opensim-SC_OLD-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.gz opensim-SC_OLD-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.bz2 opensim-SC_OLD-48672c7fd601ca2462ea91c4c09928c3a668e640.tar.xz |
Move script and notecard open perms checks from ClientView to the
perms module
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | 129 |
1 files changed, 127 insertions, 2 deletions
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 |