diff options
author | UbitUmarov | 2019-02-15 01:09:37 +0000 |
---|---|---|
committer | UbitUmarov | 2019-02-15 01:09:37 +0000 |
commit | f58e1f626562778a5491a6bad79b18b3962a6c38 (patch) | |
tree | d1e9bb0fe098e7cff3cc18f4b522d995e7c43da2 | |
parent | Remove some more cut-and-paste typos in 6dof constraint setup in XNA (diff) | |
download | opensim-SC-f58e1f626562778a5491a6bad79b18b3962a6c38.zip opensim-SC-f58e1f626562778a5491a6bad79b18b3962a6c38.tar.gz opensim-SC-f58e1f626562778a5491a6bad79b18b3962a6c38.tar.bz2 opensim-SC-f58e1f626562778a5491a6bad79b18b3962a6c38.tar.xz |
mantis 8479: deep change DeRezObjects(..) doing independent permitions checks per action. m_useTrashOnDelete should now work except if god deletes, but still not recomended
-rw-r--r-- | OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 162 |
2 files changed, 71 insertions, 103 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 7509686..eae6d6f 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -94,19 +94,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
94 | m_inventoryDeletes.Enqueue(dtis); | 94 | m_inventoryDeletes.Enqueue(dtis); |
95 | } | 95 | } |
96 | 96 | ||
97 | if (Enabled) | ||
98 | lock (m_inventoryTicker) | ||
99 | m_inventoryTicker.Start(); | ||
100 | |||
101 | // Visually remove it, even if it isnt really gone yet. This means that if we crash before the object | ||
102 | // has gone to inventory, it will reappear in the region again on restart instead of being lost. | ||
103 | // This is not ideal since the object will still be available for manipulation when it should be, but it's | ||
104 | // better than losing the object for now. | ||
105 | if (permissionToDelete) | 97 | if (permissionToDelete) |
106 | { | 98 | { |
107 | foreach (SceneObjectGroup g in objectGroups) | 99 | foreach (SceneObjectGroup g in objectGroups) |
108 | g.DeleteGroupFromScene(false); | 100 | g.DeleteGroupFromScene(false); |
109 | } | 101 | } |
102 | |||
103 | if (Enabled) | ||
104 | lock (m_inventoryTicker) | ||
105 | m_inventoryTicker.Start(); | ||
110 | } | 106 | } |
111 | 107 | ||
112 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 108 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e6e0354..6450c8b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2110,7 +2110,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | // build a list of eligible objects | 2110 | // build a list of eligible objects |
2111 | List<uint> deleteIDs = new List<uint>(); | 2111 | List<uint> deleteIDs = new List<uint>(); |
2112 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2112 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
2113 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | 2113 | List<SceneObjectGroup> takeCopyGroups = new List<SceneObjectGroup>(); |
2114 | List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>(); | 2114 | List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>(); |
2115 | 2115 | ||
2116 | ScenePresence sp = null; | 2116 | ScenePresence sp = null; |
@@ -2119,11 +2119,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2119 | else if(action != DeRezAction.Return) | 2119 | else if(action != DeRezAction.Return) |
2120 | return; // only Return can be called without a client | 2120 | return; // only Return can be called without a client |
2121 | 2121 | ||
2122 | // Start with true for both, then remove the flags if objects | 2122 | // this is not as 0.8x code |
2123 | // that we can't derez are part of the selection | 2123 | // 0.8x did refuse all operation is not allowed on all objects |
2124 | bool permissionToTake = true; | 2124 | // this will do it on allowed objects |
2125 | bool permissionToTakeCopy = true; | 2125 | // current viewers only ask if all allowed |
2126 | bool permissionToDelete = true; | ||
2127 | 2126 | ||
2128 | foreach (uint localID in localIDs) | 2127 | foreach (uint localID in localIDs) |
2129 | { | 2128 | { |
@@ -2136,8 +2135,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2136 | continue; | 2135 | continue; |
2137 | } | 2136 | } |
2138 | 2137 | ||
2139 | // Already deleted by someone else | 2138 | SceneObjectGroup grp = part.ParentGroup; |
2140 | if (part.ParentGroup.IsDeleted) | 2139 | if (grp == null || grp.IsDeleted) |
2141 | { | 2140 | { |
2142 | //Client still thinks the object exists, kill it | 2141 | //Client still thinks the object exists, kill it |
2143 | deleteIDs.Add(localID); | 2142 | deleteIDs.Add(localID); |
@@ -2145,128 +2144,101 @@ namespace OpenSim.Region.Framework.Scenes | |||
2145 | } | 2144 | } |
2146 | 2145 | ||
2147 | // Can't delete child prims | 2146 | // Can't delete child prims |
2148 | if (part != part.ParentGroup.RootPart) | 2147 | if (part != grp.RootPart) |
2149 | continue; | 2148 | continue; |
2150 | 2149 | ||
2151 | SceneObjectGroup grp = part.ParentGroup; | ||
2152 | if (grp.IsAttachment) | 2150 | if (grp.IsAttachment) |
2153 | continue; | 2151 | { |
2152 | if(!sp.IsGod || action != DeRezAction.Return || action != DeRezAction.Delete) | ||
2153 | continue; | ||
2154 | // this may break the attachment, but its a security action | ||
2155 | // viewers don't allow it anyways | ||
2156 | } | ||
2154 | 2157 | ||
2155 | // If child prims have invalid perms, fix them | 2158 | // If child prims have invalid perms, fix them |
2156 | grp.AdjustChildPrimPermissions(false); | 2159 | grp.AdjustChildPrimPermissions(false); |
2157 | 2160 | ||
2158 | if (remoteClient == null) | 2161 | switch (action) |
2159 | { | 2162 | { |
2160 | // Autoreturn has a null client. Nothing else does. So | 2163 | case DeRezAction.SaveToExistingUserInventoryItem: |
2161 | // allow only returns | ||
2162 | if (action != DeRezAction.Return) | ||
2163 | { | 2164 | { |
2164 | m_log.WarnFormat( | 2165 | if (Permissions.CanTakeCopyObject(grp, sp)) |
2165 | "[AGENT INVENTORY]: Ignoring attempt to {0} {1} {2} without a client", | 2166 | takeCopyGroups.Add(grp); |
2166 | action, grp.Name, grp.UUID); | 2167 | break; |
2167 | return; | ||
2168 | } | 2168 | } |
2169 | 2169 | ||
2170 | permissionToTakeCopy = false; | 2170 | case DeRezAction.TakeCopy: |
2171 | } | ||
2172 | else | ||
2173 | { | ||
2174 | if (action == DeRezAction.TakeCopy) | ||
2175 | { | 2171 | { |
2176 | if (!Permissions.CanTakeCopyObject(grp, sp)) | 2172 | if (Permissions.CanTakeCopyObject(grp, sp)) |
2177 | permissionToTakeCopy = false; | 2173 | takeCopyGroups.Add(grp); |
2174 | break; | ||
2178 | } | 2175 | } |
2179 | else | 2176 | |
2177 | case DeRezAction.Take: | ||
2180 | { | 2178 | { |
2181 | permissionToTakeCopy = false; | 2179 | if (Permissions.CanTakeObject(grp, sp)) |
2180 | takeDeleteGroups.Add(grp); | ||
2181 | break; | ||
2182 | } | 2182 | } |
2183 | if (!Permissions.CanTakeObject(grp, sp)) | ||
2184 | permissionToTake = false; | ||
2185 | |||
2186 | if (!Permissions.CanDeleteObject(grp, remoteClient)) | ||
2187 | permissionToDelete = false; | ||
2188 | } | ||
2189 | |||
2190 | // Handle god perms | ||
2191 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | ||
2192 | { | ||
2193 | permissionToTake = true; | ||
2194 | permissionToTakeCopy = true; | ||
2195 | permissionToDelete = true; | ||
2196 | } | ||
2197 | |||
2198 | // If we're re-saving, we don't even want to delete | ||
2199 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | ||
2200 | permissionToDelete = false; | ||
2201 | 2183 | ||
2202 | // if we want to take a copy, we also don't want to delete | 2184 | case DeRezAction.GodTakeCopy: |
2203 | // Note: after this point, the permissionToTakeCopy flag | ||
2204 | // becomes irrelevant. It already includes the permissionToTake | ||
2205 | // permission and after excluding no copy items here, we can | ||
2206 | // just use that. | ||
2207 | if (action == DeRezAction.TakeCopy) | ||
2208 | { | ||
2209 | // If we don't have permission, stop right here | ||
2210 | if (!permissionToTakeCopy) | ||
2211 | { | 2185 | { |
2212 | remoteClient.SendAlertMessage("You don't have permission to take the object"); | 2186 | if((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2213 | return; | 2187 | takeCopyGroups.Add(grp); |
2188 | break; | ||
2214 | } | 2189 | } |
2215 | 2190 | ||
2216 | permissionToTake = true; | 2191 | case DeRezAction.Delete: |
2217 | // Don't delete | ||
2218 | permissionToDelete = false; | ||
2219 | } | ||
2220 | |||
2221 | if (action == DeRezAction.Return) | ||
2222 | { | ||
2223 | if (remoteClient != null) | ||
2224 | { | 2192 | { |
2225 | if (Permissions.CanReturnObjects( | 2193 | if (Permissions.CanDeleteObject(grp, remoteClient)) |
2226 | null, | ||
2227 | remoteClient, | ||
2228 | new List<SceneObjectGroup>() {grp})) | ||
2229 | { | 2194 | { |
2230 | permissionToTake = true; | 2195 | if(m_useTrashOnDelete || (sp.IsGod && grp.OwnerID != sp.UUID)) |
2231 | permissionToDelete = true; | 2196 | takeDeleteGroups.Add(grp); |
2232 | if(AddToReturns) | 2197 | else |
2233 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, | 2198 | deleteGroups.Add(grp); |
2234 | "parcel owner return"); | ||
2235 | } | 2199 | } |
2200 | break; | ||
2236 | } | 2201 | } |
2237 | else // Auto return passes through here with null agent | 2202 | |
2203 | case DeRezAction.Return: | ||
2238 | { | 2204 | { |
2239 | permissionToTake = true; | 2205 | if (remoteClient != null) |
2240 | permissionToDelete = true; | 2206 | { |
2207 | if (Permissions.CanReturnObjects( null, remoteClient, new List<SceneObjectGroup>() {grp})) | ||
2208 | { | ||
2209 | takeDeleteGroups.Add(grp); | ||
2210 | if (AddToReturns) | ||
2211 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, | ||
2212 | "parcel owner return"); | ||
2213 | } | ||
2214 | } | ||
2215 | else // Auto return passes through here with null agent | ||
2216 | { | ||
2217 | takeDeleteGroups.Add(grp); | ||
2218 | } | ||
2219 | break; | ||
2241 | } | 2220 | } |
2242 | } | ||
2243 | 2221 | ||
2244 | if (permissionToDelete) | 2222 | default: |
2245 | { | 2223 | break; |
2246 | if (permissionToTake) | ||
2247 | takeDeleteGroups.Add(grp); | ||
2248 | else | ||
2249 | deleteGroups.Add(grp); | ||
2250 | deleteIDs.Add(grp.LocalId); | ||
2251 | } | 2224 | } |
2252 | else if(permissionToTake) | ||
2253 | takeGroups.Add(grp); | ||
2254 | } | 2225 | } |
2255 | 2226 | ||
2256 | SendKillObject(deleteIDs); | 2227 | if(deleteIDs.Count > 0) |
2228 | SendKillObject(deleteIDs); | ||
2257 | 2229 | ||
2258 | if (takeDeleteGroups.Count > 0) | 2230 | if (takeDeleteGroups.Count > 0) |
2259 | { | 2231 | { |
2260 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2232 | m_asyncSceneObjectDeleter.DeleteToInventory(action, destinationID, takeDeleteGroups, |
2261 | action, destinationID, takeDeleteGroups, remoteClient, | 2233 | remoteClient, true); |
2262 | true); | ||
2263 | } | 2234 | } |
2264 | if (takeGroups.Count > 0) | 2235 | |
2236 | if (takeCopyGroups.Count > 0) | ||
2265 | { | 2237 | { |
2266 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2238 | m_asyncSceneObjectDeleter.DeleteToInventory(action, destinationID, takeCopyGroups, |
2267 | action, destinationID, takeGroups, remoteClient, | 2239 | remoteClient, false); |
2268 | false); | ||
2269 | } | 2240 | } |
2241 | |||
2270 | if (deleteGroups.Count > 0) | 2242 | if (deleteGroups.Count > 0) |
2271 | { | 2243 | { |
2272 | foreach (SceneObjectGroup g in deleteGroups) | 2244 | foreach (SceneObjectGroup g in deleteGroups) |