diff options
Diffstat (limited to '')
3 files changed, 214 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 394690c..8ecea9e 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -186,7 +186,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
186 | m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED | 186 | m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED |
187 | m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED | 187 | m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED |
188 | m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED | 188 | m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED |
189 | m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT YET IMPLEMENTED | 189 | m_scene.ExternalChecks.addCheckCanCreateAvatarInventory(CanCreateAvatarInventory); //NOT YET IMPLEMENTED |
190 | m_scene.ExternalChecks.addCheckCanCopyAvatarInventory(CanCopyAvatarInventory); //NOT YET IMPLEMENTED | ||
191 | m_scene.ExternalChecks.addCheckCanEditAvatarInventory(CanEditAvatarInventory); //NOT YET IMPLEMENTED | ||
192 | m_scene.ExternalChecks.addCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory); //NOT YET IMPLEMENTED | ||
190 | m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED | 193 | m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED |
191 | 194 | ||
192 | //Register Debug Commands | 195 | //Register Debug Commands |
@@ -1219,8 +1222,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
1219 | 1222 | ||
1220 | /// <summary> | 1223 | /// <summary> |
1221 | /// Check whether the specified user is allowed to directly create the given inventory type in a prim's | 1224 | /// Check whether the specified user is allowed to directly create the given inventory type in a prim's |
1222 | /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). This permission check does not | 1225 | /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). |
1223 | /// apply to existing items that are being dragged in to that prim's inventory. | ||
1224 | /// </summary> | 1226 | /// </summary> |
1225 | /// <param name="invType"></param> | 1227 | /// <param name="invType"></param> |
1226 | /// <param name="objectID"></param> | 1228 | /// <param name="objectID"></param> |
@@ -1228,13 +1230,71 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
1228 | /// <returns></returns> | 1230 | /// <returns></returns> |
1229 | public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) | 1231 | public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) |
1230 | { | 1232 | { |
1231 | m_log.Debug("[PERMISSIONS]: CanCreateInventory called"); | 1233 | //m_log.Debug("[PERMISSIONS]: CanCreateObjectInventory called"); |
1232 | 1234 | ||
1233 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1235 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1234 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1236 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1235 | 1237 | ||
1236 | return true; | 1238 | return true; |
1237 | } | 1239 | } |
1240 | |||
1241 | /// <summary> | ||
1242 | /// Check whether the specified user is allowed to create the given inventory type in their inventory. | ||
1243 | /// </summary> | ||
1244 | /// <param name="invType"></param> | ||
1245 | /// <param name="userID"></param> | ||
1246 | /// <returns></returns> | ||
1247 | public bool CanCreateAvatarInventory(int invType, UUID userID) | ||
1248 | { | ||
1249 | //m_log.Debug("[PERMISSIONS]: CanCreateAvatarInventory called"); | ||
1250 | |||
1251 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1252 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1253 | |||
1254 | return true; | ||
1255 | } | ||
1256 | |||
1257 | /// <summary> | ||
1258 | /// Check whether the specified user is allowed to copy the given inventory type in their inventory. | ||
1259 | /// </summary> | ||
1260 | /// <param name="itemID"></param> | ||
1261 | /// <param name="userID"></param> | ||
1262 | /// <returns></returns> | ||
1263 | public bool CanCopyAvatarInventory(UUID itemID, UUID userID) | ||
1264 | { | ||
1265 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1266 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1267 | |||
1268 | return true; | ||
1269 | } | ||
1270 | |||
1271 | /// <summary> | ||
1272 | /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. | ||
1273 | /// </summary> | ||
1274 | /// <param name="itemID"></param> | ||
1275 | /// <param name="userID"></param> | ||
1276 | /// <returns></returns> | ||
1277 | public bool CanEditAvatarInventory(UUID itemID, UUID userID) | ||
1278 | { | ||
1279 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1280 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1281 | |||
1282 | return true; | ||
1283 | } | ||
1284 | |||
1285 | /// <summary> | ||
1286 | /// Check whether the specified user is allowed to delete the given inventory item from their own inventory. | ||
1287 | /// </summary> | ||
1288 | /// <param name="itemID"></param> | ||
1289 | /// <param name="userID"></param> | ||
1290 | /// <returns></returns> | ||
1291 | public bool CanDeleteAvatarInventory(UUID itemID, UUID userID) | ||
1292 | { | ||
1293 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1294 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1295 | |||
1296 | return true; | ||
1297 | } | ||
1238 | 1298 | ||
1239 | public bool CanTeleport(UUID userID) | 1299 | public bool CanTeleport(UUID userID) |
1240 | { | 1300 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index d47e068..e548f36 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -759,8 +759,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
759 | sbyte assetType, | 759 | sbyte assetType, |
760 | byte wearableType, uint nextOwnerMask, int creationDate) | 760 | byte wearableType, uint nextOwnerMask, int creationDate) |
761 | { | 761 | { |
762 | // m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); | 762 | m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); |
763 | 763 | ||
764 | if (!ExternalChecks.ExternalChecksCanCreateAvatarInventory(invType, remoteClient.AgentId)) | ||
765 | return; | ||
766 | |||
764 | if (transactionID == UUID.Zero) | 767 | if (transactionID == UUID.Zero) |
765 | { | 768 | { |
766 | CachedUserInfo userInfo | 769 | CachedUserInfo userInfo |
@@ -771,14 +774,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
771 | ScenePresence presence; | 774 | ScenePresence presence; |
772 | TryGetAvatar(remoteClient.AgentId, out presence); | 775 | TryGetAvatar(remoteClient.AgentId, out presence); |
773 | byte[] data = null; | 776 | byte[] data = null; |
777 | |||
774 | if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum | 778 | if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum |
775 | { | 779 | { |
776 | Vector3 pos=presence.AbsolutePosition; | 780 | Vector3 pos = presence.AbsolutePosition; |
777 | string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n", | 781 | string strdata = String.Format( |
782 | "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n", | ||
778 | presence.Scene.RegionInfo.RegionID, | 783 | presence.Scene.RegionInfo.RegionID, |
779 | pos.X, pos.Y, pos.Z, | 784 | pos.X, pos.Y, pos.Z, |
780 | presence.RegionHandle); | 785 | presence.RegionHandle); |
781 | data=Encoding.ASCII.GetBytes(strdata); | 786 | data = Encoding.ASCII.GetBytes(strdata); |
782 | } | 787 | } |
783 | 788 | ||
784 | AssetBase asset = CreateAsset(name, description, assetType, data); | 789 | AssetBase asset = CreateAsset(name, description, assetType, data); |
@@ -1245,9 +1250,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1245 | if (part != null) | 1250 | if (part != null) |
1246 | { | 1251 | { |
1247 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 1252 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1248 | { | ||
1249 | return; | 1253 | return; |
1250 | } | ||
1251 | 1254 | ||
1252 | TaskInventoryItem currentItem = part.GetInventoryItem(itemID); | 1255 | TaskInventoryItem currentItem = part.GetInventoryItem(itemID); |
1253 | 1256 | ||
@@ -1344,9 +1347,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1344 | if (part != null) | 1347 | if (part != null) |
1345 | { | 1348 | { |
1346 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 1349 | if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1347 | { | ||
1348 | return; | 1350 | return; |
1349 | } | ||
1350 | 1351 | ||
1351 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1352 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1352 | // TODO: switch to posting on_rez here when scripts | 1353 | // TODO: switch to posting on_rez here when scripts |
@@ -1573,7 +1574,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1573 | //If they can take, they can delete! | 1574 | //If they can take, they can delete! |
1574 | permissionToDelete = permissionToTake; | 1575 | permissionToDelete = permissionToTake; |
1575 | } | 1576 | } |
1576 | |||
1577 | else if (destination == 6) //Delete | 1577 | else if (destination == 6) //Delete |
1578 | { | 1578 | { |
1579 | permissionToTake = | 1579 | permissionToTake = |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 0e018e8..cc627b0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -1089,8 +1089,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1089 | 1089 | ||
1090 | /// <summary> | 1090 | /// <summary> |
1091 | /// Check whether the specified user is allowed to directly create the given inventory type in a prim's | 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 | 1092 | /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). |
1093 | /// apply to existing items that are being dragged in to that prim's inventory. | ||
1094 | /// </summary> | 1093 | /// </summary> |
1095 | /// <param name="invType"></param> | 1094 | /// <param name="invType"></param> |
1096 | /// <param name="objectID"></param> | 1095 | /// <param name="objectID"></param> |
@@ -1164,7 +1163,147 @@ namespace OpenSim.Region.Environment.Scenes | |||
1164 | 1163 | ||
1165 | return true; | 1164 | return true; |
1166 | } | 1165 | } |
1166 | |||
1167 | public delegate bool CanCreateAvatarInventory(int invType, UUID userID); | ||
1168 | private List<CanCreateAvatarInventory> CanCreateAvatarInventoryCheckFunctions | ||
1169 | = new List<CanCreateAvatarInventory>(); | ||
1170 | |||
1171 | public void addCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc) | ||
1172 | { | ||
1173 | if (!CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1174 | CanCreateAvatarInventoryCheckFunctions.Add(delegateFunc); | ||
1175 | } | ||
1176 | |||
1177 | public void removeCheckCanCreateAvatarInventory(CanCreateAvatarInventory delegateFunc) | ||
1178 | { | ||
1179 | if (CanCreateAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1180 | CanCreateAvatarInventoryCheckFunctions.Remove(delegateFunc); | ||
1181 | } | ||
1182 | |||
1183 | /// <summary> | ||
1184 | /// Check whether the specified user is allowed to create the given inventory type in their inventory. | ||
1185 | /// </summary> | ||
1186 | /// <param name="invType"></param> | ||
1187 | /// <param name="userID"></param> | ||
1188 | /// <returns></returns> | ||
1189 | public bool ExternalChecksCanCreateAvatarInventory(int invType, UUID userID) | ||
1190 | { | ||
1191 | foreach (CanCreateAvatarInventory check in CanCreateAvatarInventoryCheckFunctions) | ||
1192 | { | ||
1193 | if (check(invType, userID) == false) | ||
1194 | { | ||
1195 | return false; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | return true; | ||
1200 | } | ||
1201 | |||
1202 | public delegate bool CanEditAvatarInventory(UUID itemID, UUID userID); | ||
1203 | private List<CanEditAvatarInventory> CanEditAvatarInventoryCheckFunctions | ||
1204 | = new List<CanEditAvatarInventory>(); | ||
1205 | |||
1206 | public void addCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc) | ||
1207 | { | ||
1208 | if (!CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1209 | CanEditAvatarInventoryCheckFunctions.Add(delegateFunc); | ||
1210 | } | ||
1167 | 1211 | ||
1212 | public void removeCheckCanEditAvatarInventory(CanEditAvatarInventory delegateFunc) | ||
1213 | { | ||
1214 | if (CanEditAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1215 | CanEditAvatarInventoryCheckFunctions.Remove(delegateFunc); | ||
1216 | } | ||
1217 | |||
1218 | /// <summary> | ||
1219 | /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. | ||
1220 | /// </summary> | ||
1221 | /// <param name="itemID"></param> | ||
1222 | /// <param name="userID"></param> | ||
1223 | /// <returns></returns> | ||
1224 | public bool ExternalChecksCanEditAvatarInventory(UUID itemID, UUID userID) | ||
1225 | { | ||
1226 | foreach (CanEditAvatarInventory check in CanEditAvatarInventoryCheckFunctions) | ||
1227 | { | ||
1228 | if (check(itemID, userID) == false) | ||
1229 | { | ||
1230 | return false; | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | return true; | ||
1235 | } | ||
1236 | |||
1237 | public delegate bool CanCopyAvatarInventory(UUID itemID, UUID userID); | ||
1238 | private List<CanCopyAvatarInventory> CanCopyAvatarInventoryCheckFunctions | ||
1239 | = new List<CanCopyAvatarInventory>(); | ||
1240 | |||
1241 | public void addCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc) | ||
1242 | { | ||
1243 | if (!CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1244 | CanCopyAvatarInventoryCheckFunctions.Add(delegateFunc); | ||
1245 | } | ||
1246 | |||
1247 | public void removeCheckCanCopyAvatarInventory(CanCopyAvatarInventory delegateFunc) | ||
1248 | { | ||
1249 | if (CanCopyAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1250 | CanCopyAvatarInventoryCheckFunctions.Remove(delegateFunc); | ||
1251 | } | ||
1252 | |||
1253 | /// <summary> | ||
1254 | /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. | ||
1255 | /// </summary> | ||
1256 | /// <param name="itemID"></param> | ||
1257 | /// <param name="userID"></param> | ||
1258 | /// <returns></returns> | ||
1259 | public bool ExternalChecksCanCopyAvatarInventory(UUID itemID, UUID userID) | ||
1260 | { | ||
1261 | foreach (CanCopyAvatarInventory check in CanCopyAvatarInventoryCheckFunctions) | ||
1262 | { | ||
1263 | if (check(itemID, userID) == false) | ||
1264 | { | ||
1265 | return false; | ||
1266 | } | ||
1267 | } | ||
1268 | |||
1269 | return true; | ||
1270 | } | ||
1271 | |||
1272 | public delegate bool CanDeleteAvatarInventory(UUID itemID, UUID userID); | ||
1273 | private List<CanDeleteAvatarInventory> CanDeleteAvatarInventoryCheckFunctions | ||
1274 | = new List<CanDeleteAvatarInventory>(); | ||
1275 | |||
1276 | public void addCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc) | ||
1277 | { | ||
1278 | if (!CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1279 | CanDeleteAvatarInventoryCheckFunctions.Add(delegateFunc); | ||
1280 | } | ||
1281 | |||
1282 | public void removeCheckCanDeleteAvatarInventory(CanDeleteAvatarInventory delegateFunc) | ||
1283 | { | ||
1284 | if (CanDeleteAvatarInventoryCheckFunctions.Contains(delegateFunc)) | ||
1285 | CanDeleteAvatarInventoryCheckFunctions.Remove(delegateFunc); | ||
1286 | } | ||
1287 | |||
1288 | /// <summary> | ||
1289 | /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. | ||
1290 | /// </summary> | ||
1291 | /// <param name="itemID"></param> | ||
1292 | /// <param name="userID"></param> | ||
1293 | /// <returns></returns> | ||
1294 | public bool ExternalChecksCanDeleteAvatarInventory(UUID itemID, UUID userID) | ||
1295 | { | ||
1296 | foreach (CanDeleteAvatarInventory check in CanDeleteAvatarInventoryCheckFunctions) | ||
1297 | { | ||
1298 | if (check(itemID, userID) == false) | ||
1299 | { | ||
1300 | return false; | ||
1301 | } | ||
1302 | } | ||
1303 | |||
1304 | return true; | ||
1305 | } | ||
1306 | |||
1168 | public delegate bool CanTeleport(UUID userID); | 1307 | public delegate bool CanTeleport(UUID userID); |
1169 | private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>(); | 1308 | private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>(); |
1170 | 1309 | ||