diff options
author | Justin Clarke Casey | 2008-11-13 19:16:15 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-13 19:16:15 +0000 |
commit | bf68255b86093afe68392973054af7c3e2f2121b (patch) | |
tree | 13eedccc5933994ee65d80ee86385583480c786b /OpenSim | |
parent | Make scripts in objects rezzed from script compile synchronously to close (diff) | |
download | opensim-SC-bf68255b86093afe68392973054af7c3e2f2121b.zip opensim-SC-bf68255b86093afe68392973054af7c3e2f2121b.tar.gz opensim-SC-bf68255b86093afe68392973054af7c3e2f2121b.tar.bz2 opensim-SC-bf68255b86093afe68392973054af7c3e2f2121b.tar.xz |
* refactor: rename object inventory permission checks to distinguish between task inventory and agent inventory
Diffstat (limited to 'OpenSim')
3 files changed, 53 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index b6b7d4a..394690c 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -184,12 +184,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
184 | m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED | 184 | m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED |
185 | m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED | 185 | m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED |
186 | m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED | 186 | m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED |
187 | m_scene.ExternalChecks.addCheckCanCopyInventory(CanCopyInventory); //NOT YET IMPLEMENTED | 187 | m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED |
188 | m_scene.ExternalChecks.addCheckCanDeleteInventory(CanDeleteInventory); //NOT YET IMPLEMENTED | 188 | m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED |
189 | m_scene.ExternalChecks.addCheckCanCreateInventory(CanCreateInventory); //NOT YET IMPLEMENTED | 189 | m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT YET IMPLEMENTED |
190 | m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED | 190 | m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED |
191 | 191 | ||
192 | |||
193 | //Register Debug Commands | 192 | //Register Debug Commands |
194 | Command bypassCommand = new Command("bypass", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBypassPermissions, "Force the permissions a specific way to test permissions"); | 193 | Command bypassCommand = new Command("bypass", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBypassPermissions, "Force the permissions a specific way to test permissions"); |
195 | bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean"); | 194 | bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean"); |
@@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
1202 | return true; | 1201 | return true; |
1203 | } | 1202 | } |
1204 | 1203 | ||
1205 | public bool CanCopyInventory(UUID itemID, UUID objectID, UUID userID) | 1204 | public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) |
1206 | { | 1205 | { |
1207 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1206 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1208 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1207 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -1210,7 +1209,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
1210 | return true; | 1209 | return true; |
1211 | } | 1210 | } |
1212 | 1211 | ||
1213 | public bool CanDeleteInventory(UUID itemID, UUID objectID, UUID userID) | 1212 | public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) |
1214 | { | 1213 | { |
1215 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1214 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1216 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1215 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -1227,7 +1226,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
1227 | /// <param name="objectID"></param> | 1226 | /// <param name="objectID"></param> |
1228 | /// <param name="userID"></param> | 1227 | /// <param name="userID"></param> |
1229 | /// <returns></returns> | 1228 | /// <returns></returns> |
1230 | public bool CanCreateInventory(int invType, UUID objectID, UUID userID) | 1229 | public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) |
1231 | { | 1230 | { |
1232 | m_log.Debug("[PERMISSIONS]: CanCreateInventory called"); | 1231 | m_log.Debug("[PERMISSIONS]: CanCreateInventory called"); |
1233 | 1232 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 19c9d08..d47e068 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1387,7 +1387,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1387 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 1387 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1388 | return; | 1388 | return; |
1389 | 1389 | ||
1390 | if (!ExternalChecks.ExternalChecksCanCreateInventory(itemBase.InvType, part.UUID, remoteClient.AgentId)) | 1390 | if (!ExternalChecks.ExternalChecksCanCreateObjectInventory( |
1391 | itemBase.InvType, part.UUID, remoteClient.AgentId)) | ||
1391 | return; | 1392 | return; |
1392 | 1393 | ||
1393 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); | 1394 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index c5bbcdd..0e018e8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -1070,51 +1070,63 @@ namespace OpenSim.Region.Environment.Scenes | |||
1070 | 1070 | ||
1071 | #endregion | 1071 | #endregion |
1072 | 1072 | ||
1073 | public delegate bool CanCreateInventory(int invType, UUID objectID, UUID userID); | 1073 | public delegate bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID); |
1074 | private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>(); | 1074 | private List<CanCreateObjectInventory> CanCreateObjectInventoryCheckFunctions |
1075 | = new List<CanCreateObjectInventory>(); | ||
1075 | 1076 | ||
1076 | public void addCheckCanCreateInventory(CanCreateInventory delegateFunc) | 1077 | |
1078 | public void addCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) | ||
1077 | { | 1079 | { |
1078 | if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc)) | 1080 | if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1079 | CanCreateInventoryCheckFunctions.Add(delegateFunc); | 1081 | CanCreateObjectInventoryCheckFunctions.Add(delegateFunc); |
1080 | } | 1082 | } |
1081 | 1083 | ||
1082 | public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc) | 1084 | public void removeCheckCanCreateObjectInventory(CanCreateObjectInventory delegateFunc) |
1083 | { | 1085 | { |
1084 | if (CanCreateInventoryCheckFunctions.Contains(delegateFunc)) | 1086 | if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1085 | CanCreateInventoryCheckFunctions.Remove(delegateFunc); | 1087 | CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc); |
1086 | } | 1088 | } |
1087 | 1089 | ||
1088 | public bool ExternalChecksCanCreateInventory(int invType, UUID objectID, UUID userID) | 1090 | /// <summary> |
1091 | /// Check whether the specified user is allowed to directly create the given inventory type in a prim's | ||
1092 | /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). This permission check does not | ||
1093 | /// apply to existing items that are being dragged in to that prim's inventory. | ||
1094 | /// </summary> | ||
1095 | /// <param name="invType"></param> | ||
1096 | /// <param name="objectID"></param> | ||
1097 | /// <param name="userID"></param> | ||
1098 | /// <returns></returns> | ||
1099 | public bool ExternalChecksCanCreateObjectInventory(int invType, UUID objectID, UUID userID) | ||
1089 | { | 1100 | { |
1090 | foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions) | 1101 | foreach (CanCreateObjectInventory check in CanCreateObjectInventoryCheckFunctions) |
1091 | { | 1102 | { |
1092 | if (check(invType, objectID, userID) == false) | 1103 | if (check(invType, objectID, userID) == false) |
1093 | { | 1104 | { |
1094 | return false; | 1105 | return false; |
1095 | } | 1106 | } |
1096 | } | 1107 | } |
1108 | |||
1097 | return true; | 1109 | return true; |
1098 | } | 1110 | } |
1099 | 1111 | ||
1100 | public delegate bool CanCopyInventory(UUID itemID, UUID objectID, UUID userID); | 1112 | public delegate bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID); |
1101 | private List<CanCopyInventory> CanCopyInventoryCheckFunctions = new List<CanCopyInventory>(); | 1113 | private List<CanCopyObjectInventory> CanCopyObjectInventoryCheckFunctions = new List<CanCopyObjectInventory>(); |
1102 | 1114 | ||
1103 | public void addCheckCanCopyInventory(CanCopyInventory delegateFunc) | 1115 | public void addCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) |
1104 | { | 1116 | { |
1105 | if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc)) | 1117 | if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1106 | CanCopyInventoryCheckFunctions.Add(delegateFunc); | 1118 | CanCopyObjectInventoryCheckFunctions.Add(delegateFunc); |
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc) | 1121 | public void removeCheckCanCopyObjectInventory(CanCopyObjectInventory delegateFunc) |
1110 | { | 1122 | { |
1111 | if (CanCopyInventoryCheckFunctions.Contains(delegateFunc)) | 1123 | if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1112 | CanCopyInventoryCheckFunctions.Remove(delegateFunc); | 1124 | CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc); |
1113 | } | 1125 | } |
1114 | 1126 | ||
1115 | public bool ExternalChecksCanCopyInventory(UUID itemID, UUID objectID, UUID userID) | 1127 | public bool ExternalChecksCanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) |
1116 | { | 1128 | { |
1117 | foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions) | 1129 | foreach (CanCopyObjectInventory check in CanCopyObjectInventoryCheckFunctions) |
1118 | { | 1130 | { |
1119 | if (check(itemID, objectID, userID) == false) | 1131 | if (check(itemID, objectID, userID) == false) |
1120 | { | 1132 | { |
@@ -1124,30 +1136,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
1124 | return true; | 1136 | return true; |
1125 | } | 1137 | } |
1126 | 1138 | ||
1127 | public delegate bool CanDeleteInventory(UUID itemID, UUID objectID, UUID userID); | 1139 | public delegate bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID); |
1128 | private List<CanDeleteInventory> CanDeleteInventoryCheckFunctions = new List<CanDeleteInventory>(); | 1140 | private List<CanDeleteObjectInventory> CanDeleteObjectInventoryCheckFunctions |
1141 | = new List<CanDeleteObjectInventory>(); | ||
1129 | 1142 | ||
1130 | public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc) | 1143 | public void addCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) |
1131 | { | 1144 | { |
1132 | if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) | 1145 | if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1133 | CanDeleteInventoryCheckFunctions.Add(delegateFunc); | 1146 | CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc); |
1134 | } | 1147 | } |
1135 | 1148 | ||
1136 | public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc) | 1149 | public void removeCheckCanDeleteObjectInventory(CanDeleteObjectInventory delegateFunc) |
1137 | { | 1150 | { |
1138 | if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) | 1151 | if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc)) |
1139 | CanDeleteInventoryCheckFunctions.Remove(delegateFunc); | 1152 | CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc); |
1140 | } | 1153 | } |
1141 | 1154 | ||
1142 | public bool ExternalChecksCanDeleteInventory(UUID itemID, UUID objectID, UUID userID) | 1155 | public bool ExternalChecksCanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) |
1143 | { | 1156 | { |
1144 | foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions) | 1157 | foreach (CanDeleteObjectInventory check in CanDeleteObjectInventoryCheckFunctions) |
1145 | { | 1158 | { |
1146 | if (check(itemID, objectID, userID) == false) | 1159 | if (check(itemID, objectID, userID) == false) |
1147 | { | 1160 | { |
1148 | return false; | 1161 | return false; |
1149 | } | 1162 | } |
1150 | } | 1163 | } |
1164 | |||
1151 | return true; | 1165 | return true; |
1152 | } | 1166 | } |
1153 | 1167 | ||