diff options
author | UbitUmarov | 2017-01-25 19:39:58 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-25 19:39:58 +0000 |
commit | 02fbe5a740e81280bff16caaf50f5f6326fc9c80 (patch) | |
tree | 59219a664b08884ffa168171aab62c5062d55486 /OpenSim/Region/CoreModules/World | |
parent | fix test setup (diff) | |
download | opensim-SC-02fbe5a740e81280bff16caaf50f5f6326fc9c80.zip opensim-SC-02fbe5a740e81280bff16caaf50f5f6326fc9c80.tar.gz opensim-SC-02fbe5a740e81280bff16caaf50f5f6326fc9c80.tar.bz2 opensim-SC-02fbe5a740e81280bff16caaf50f5f6326fc9c80.tar.xz |
add and use CanDropInObjectInv
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 191 |
1 files changed, 121 insertions, 70 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 1973bcb..bbebce1 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | protected Scene m_scene; | 51 | protected Scene m_scene; |
52 | protected ScenePermissions scenePermissions; | ||
52 | protected bool m_Enabled; | 53 | protected bool m_Enabled; |
53 | 54 | ||
54 | private InventoryFolderImpl m_libraryRootFolder; | 55 | private InventoryFolderImpl m_libraryRootFolder; |
@@ -253,74 +254,74 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
253 | m_scene = scene; | 254 | m_scene = scene; |
254 | 255 | ||
255 | scene.RegisterModuleInterface<IPermissionsModule>(this); | 256 | scene.RegisterModuleInterface<IPermissionsModule>(this); |
257 | scenePermissions = m_scene.Permissions; | ||
256 | 258 | ||
257 | //Register functions with Scene External Checks! | 259 | //Register functions with Scene External Checks! |
258 | m_scene.Permissions.OnBypassPermissions += BypassPermissions; | 260 | scenePermissions.OnBypassPermissions += BypassPermissions; |
259 | m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions; | 261 | scenePermissions.OnSetBypassPermissions += SetBypassPermissions; |
260 | m_scene.Permissions.OnPropagatePermissions += PropagatePermissions; | 262 | scenePermissions.OnPropagatePermissions += PropagatePermissions; |
261 | 263 | ||
262 | m_scene.Permissions.OnIsGridGod += IsGridAdministrator; | 264 | scenePermissions.OnIsGridGod += IsGridAdministrator; |
263 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; | 265 | scenePermissions.OnIsAdministrator += IsAdministrator; |
264 | m_scene.Permissions.OnIsEstateManager += IsEstateManager; | 266 | scenePermissions.OnIsEstateManager += IsEstateManager; |
265 | 267 | ||
266 | m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; | 268 | scenePermissions.OnGenerateClientFlags += GenerateClientFlags; |
267 | 269 | ||
268 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; | 270 | scenePermissions.OnIssueEstateCommand += CanIssueEstateCommand; |
269 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; | 271 | scenePermissions.OnRunConsoleCommand += CanRunConsoleCommand; |
270 | 272 | ||
271 | m_scene.Permissions.OnTeleport += CanTeleport; | 273 | scenePermissions.OnTeleport += CanTeleport; |
272 | 274 | ||
273 | m_scene.Permissions.OnInstantMessage += CanInstantMessage; | 275 | scenePermissions.OnInstantMessage += CanInstantMessage; |
274 | 276 | ||
275 | m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; | 277 | scenePermissions.OnAbandonParcel += CanAbandonParcel; |
276 | m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; | 278 | scenePermissions.OnReclaimParcel += CanReclaimParcel; |
277 | m_scene.Permissions.OnDeedParcel += CanDeedParcel; | 279 | scenePermissions.OnDeedParcel += CanDeedParcel; |
278 | m_scene.Permissions.OnSellParcel += CanSellParcel; | 280 | scenePermissions.OnSellParcel += CanSellParcel; |
279 | m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; | 281 | scenePermissions.OnEditParcelProperties += CanEditParcelProperties; |
280 | m_scene.Permissions.OnTerraformLand += CanTerraformLand; | 282 | scenePermissions.OnTerraformLand += CanTerraformLand; |
281 | m_scene.Permissions.OnBuyLand += CanBuyLand; | 283 | scenePermissions.OnBuyLand += CanBuyLand; |
282 | 284 | ||
283 | m_scene.Permissions.OnRezObject += CanRezObject; | 285 | scenePermissions.OnRezObject += CanRezObject; |
284 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; | 286 | scenePermissions.OnObjectEntry += CanObjectEntry; |
285 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; | 287 | scenePermissions.OnReturnObjects += CanReturnObjects; |
286 | 288 | ||
287 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 289 | scenePermissions.OnDuplicateObject += CanDuplicateObject; |
288 | m_scene.Permissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; | 290 | scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; |
289 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; | 291 | scenePermissions.OnDeleteObject += CanDeleteObject; |
290 | m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs; | 292 | scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs; |
291 | m_scene.Permissions.OnEditObject += CanEditObject; | 293 | scenePermissions.OnEditObject += CanEditObject; |
292 | m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; | 294 | scenePermissions.OnInventoryTransfer += CanInventoryTransfer; |
293 | m_scene.Permissions.OnMoveObject += CanMoveObject; | 295 | scenePermissions.OnMoveObject += CanMoveObject; |
294 | m_scene.Permissions.OnTakeObject += CanTakeObject; | 296 | scenePermissions.OnTakeObject += CanTakeObject; |
295 | m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; | 297 | scenePermissions.OnTakeCopyObject += CanTakeCopyObject; |
296 | m_scene.Permissions.OnLinkObject += CanLinkObject; | 298 | scenePermissions.OnLinkObject += CanLinkObject; |
297 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; | 299 | scenePermissions.OnDelinkObject += CanDelinkObject; |
298 | m_scene.Permissions.OnDeedObject += CanDeedObject; | 300 | scenePermissions.OnDeedObject += CanDeedObject; |
299 | m_scene.Permissions.OnSellGroupObject += CanSellGroupObject; | 301 | scenePermissions.OnSellGroupObject += CanSellGroupObject; |
300 | 302 | ||
301 | 303 | scenePermissions.OnCreateObjectInventory += CanCreateObjectInventory; | |
302 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; | 304 | scenePermissions.OnEditObjectInventory += CanEditObjectInventory; |
303 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory; | 305 | scenePermissions.OnCopyObjectInventory += CanCopyObjectInventory; |
304 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; | 306 | scenePermissions.OnDeleteObjectInventory += CanDeleteObjectInventory; |
305 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; | 307 | scenePermissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv; |
306 | m_scene.Permissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv; | 308 | scenePermissions.OnDropInObjectInv += CanDropInObjectInv; |
307 | 309 | ||
308 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; | 310 | scenePermissions.OnViewNotecard += CanViewNotecard; |
309 | m_scene.Permissions.OnViewScript += CanViewScript; | 311 | scenePermissions.OnViewScript += CanViewScript; |
310 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; | 312 | scenePermissions.OnEditNotecard += CanEditNotecard; |
311 | m_scene.Permissions.OnEditScript += CanEditScript; | 313 | scenePermissions.OnEditScript += CanEditScript; |
312 | m_scene.Permissions.OnResetScript += CanResetScript; | 314 | scenePermissions.OnResetScript += CanResetScript; |
313 | m_scene.Permissions.OnRunScript += CanRunScript; | 315 | scenePermissions.OnRunScript += CanRunScript; |
314 | m_scene.Permissions.OnCompileScript += CanCompileScript; | 316 | scenePermissions.OnCompileScript += CanCompileScript; |
315 | 317 | ||
316 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; | 318 | scenePermissions.OnCreateUserInventory += CanCreateUserInventory; |
317 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; | 319 | scenePermissions.OnCopyUserInventory += CanCopyUserInventory; |
318 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; | 320 | scenePermissions.OnEditUserInventory += CanEditUserInventory; |
319 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; | 321 | scenePermissions.OnDeleteUserInventory += CanDeleteUserInventory; |
320 | 322 | ||
321 | 323 | scenePermissions.OnControlPrimMedia += CanControlPrimMedia; | |
322 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | 324 | scenePermissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; |
323 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; | ||
324 | 325 | ||
325 | m_scene.AddCommand("Users", this, "bypass permissions", | 326 | m_scene.AddCommand("Users", this, "bypass permissions", |
326 | "bypass permissions <true / false>", | 327 | "bypass permissions <true / false>", |
@@ -2094,11 +2095,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2094 | private bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart) | 2095 | private bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart) |
2095 | { | 2096 | { |
2096 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 2097 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
2097 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
2098 | 2098 | ||
2099 | if (sourcePart == null || destPart == null || item == null) | 2099 | if (sourcePart == null || destPart == null || item == null) |
2100 | return false; | 2100 | return false; |
2101 | 2101 | ||
2102 | if (m_bypassPermissions) | ||
2103 | return m_bypassPermissionsValue; | ||
2104 | |||
2102 | SceneObjectGroup srcsog = sourcePart.ParentGroup; | 2105 | SceneObjectGroup srcsog = sourcePart.ParentGroup; |
2103 | SceneObjectGroup destsog = destPart.ParentGroup; | 2106 | SceneObjectGroup destsog = destPart.ParentGroup; |
2104 | if (srcsog == null || destsog == null) | 2107 | if (srcsog == null || destsog == null) |
@@ -2127,12 +2130,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2127 | if(item.InvType == (int)InventoryType.LSL) | 2130 | if(item.InvType == (int)InventoryType.LSL) |
2128 | return false; | 2131 | return false; |
2129 | 2132 | ||
2130 | if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | 2133 | if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) |
2131 | return false; | 2134 | return false; |
2132 | } | 2135 | } |
2133 | else | 2136 | else |
2134 | { | 2137 | { |
2135 | if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 && | 2138 | if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 && |
2136 | (destsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0) | 2139 | (destsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0) |
2137 | return false; | 2140 | return false; |
2138 | } | 2141 | } |
@@ -2140,6 +2143,54 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2140 | return true; | 2143 | return true; |
2141 | } | 2144 | } |
2142 | 2145 | ||
2146 | private bool CanDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart) | ||
2147 | { | ||
2148 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
2149 | |||
2150 | if (sp == null || sp.IsDeleted || destPart == null || item == null) | ||
2151 | return false; | ||
2152 | |||
2153 | SceneObjectGroup destsog = destPart.ParentGroup; | ||
2154 | if (destsog == null || destsog.IsDeleted) | ||
2155 | return false; | ||
2156 | |||
2157 | if (m_bypassPermissions) | ||
2158 | return m_bypassPermissionsValue; | ||
2159 | |||
2160 | if(sp.IsGod) | ||
2161 | return true; | ||
2162 | |||
2163 | // dest is locked | ||
2164 | if((destsog.EffectiveOwnerPerms & (uint)PermissionMask.Move) == 0) | ||
2165 | return false; | ||
2166 | |||
2167 | UUID destOwner = destsog.OwnerID; | ||
2168 | UUID spID = sp.UUID; | ||
2169 | bool spNotOwner = spID != destOwner; | ||
2170 | |||
2171 | // scripts can't be droped | ||
2172 | if(spNotOwner && item.InvType == (int)InventoryType.LSL) | ||
2173 | return false; | ||
2174 | |||
2175 | if(spNotOwner || item.Owner != destOwner) | ||
2176 | { | ||
2177 | // no copy item will be moved if it has transfer | ||
2178 | uint itperms = item.CurrentPermissions; | ||
2179 | if((itperms & (uint)PermissionMask.Transfer) == 0) | ||
2180 | return false; | ||
2181 | } | ||
2182 | |||
2183 | // allowdrop is a root part thing and does bypass modify rights | ||
2184 | if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
2185 | return true; | ||
2186 | |||
2187 | uint perms = GetObjectPermissions(spID, destsog, true); | ||
2188 | if((perms & (uint)PermissionMask.Modify) == 0) | ||
2189 | return false; | ||
2190 | |||
2191 | return true; | ||
2192 | } | ||
2193 | |||
2143 | private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) | 2194 | private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) |
2144 | { | 2195 | { |
2145 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 2196 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
@@ -2153,7 +2204,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2153 | if (sog == null) | 2204 | if (sog == null) |
2154 | return false; | 2205 | return false; |
2155 | 2206 | ||
2156 | uint perms = GetObjectPermissions(objectID, sog, true); | 2207 | uint perms = GetObjectPermissions(userID, sog, true); |
2157 | if((perms & (uint)PermissionMask.Modify) == 0) | 2208 | if((perms & (uint)PermissionMask.Modify) == 0) |
2158 | return false; | 2209 | return false; |
2159 | 2210 | ||