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/Region/Environment/Scenes | |
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/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | 76 |
2 files changed, 47 insertions, 32 deletions
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 | ||