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 | |
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
3 files changed, 242 insertions, 173 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 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 29666d5..7377e6d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1645,76 +1645,78 @@ namespace OpenSim.Region.Framework.Scenes | |||
1645 | uint primLocalID) | 1645 | uint primLocalID) |
1646 | { | 1646 | { |
1647 | UUID itemID = itemInfo.ItemID; | 1647 | UUID itemID = itemInfo.ItemID; |
1648 | if (itemID == UUID.Zero) | ||
1649 | { | ||
1650 | m_log.ErrorFormat( | ||
1651 | "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero to update for {1}!", | ||
1652 | remoteClient.Name); | ||
1653 | return; | ||
1654 | } | ||
1648 | 1655 | ||
1649 | // Find the prim we're dealing with | 1656 | // Find the prim we're dealing with |
1650 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 1657 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
1658 | if(part == null) | ||
1659 | { | ||
1660 | m_log.WarnFormat( | ||
1661 | "[PRIM INVENTORY]: " + | ||
1662 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1663 | itemID, primLocalID, remoteClient.Name); | ||
1664 | return; | ||
1665 | } | ||
1651 | 1666 | ||
1652 | if (part != null) | 1667 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); |
1668 | |||
1669 | if (currentItem == null) | ||
1653 | { | 1670 | { |
1654 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); | 1671 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); |
1655 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() | ||
1656 | & (uint)PrimFlags.AllowInventoryDrop) != 0; | ||
1657 | 1672 | ||
1658 | // Explicity allow anyone to add to the inventory if the | 1673 | // if not found Try library |
1659 | // AllowInventoryDrop flag has been set. Don't however let | 1674 | if (item == null && LibraryService != null && LibraryService.LibraryRootFolder != null) |
1660 | // them update an item unless they pass the external checks | 1675 | item = LibraryService.LibraryRootFolder.FindItem(itemID); |
1661 | // | ||
1662 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId) | ||
1663 | && (currentItem != null || !allowInventoryDrop)) | ||
1664 | return; | ||
1665 | 1676 | ||
1666 | if (currentItem == null) | 1677 | if(item == null) |
1667 | { | 1678 | { |
1668 | UUID copyID = UUID.Random(); | 1679 | m_log.ErrorFormat( |
1669 | if (itemID != UUID.Zero) | 1680 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", |
1670 | { | 1681 | itemID, remoteClient.Name); |
1671 | InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); | 1682 | return; |
1683 | } | ||
1672 | 1684 | ||
1673 | // Try library | 1685 | if (!Permissions.CanDropInObjectInv(item, remoteClient, part)) |
1674 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) | 1686 | return; |
1675 | { | ||
1676 | item = LibraryService.LibraryRootFolder.FindItem(itemID); | ||
1677 | } | ||
1678 | 1687 | ||
1679 | // If we've found the item in the user's inventory or in the library | 1688 | UUID copyID = UUID.Random(); |
1680 | if (item != null) | 1689 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); |
1681 | { | 1690 | m_log.InfoFormat( |
1682 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); | 1691 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1683 | m_log.InfoFormat( | 1692 | item.Name, primLocalID, remoteClient.Name); |
1684 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1693 | part.SendPropertiesToClient(remoteClient); |
1685 | item.Name, primLocalID, remoteClient.Name); | 1694 | if (!Permissions.BypassPermissions()) |
1686 | part.SendPropertiesToClient(remoteClient); | 1695 | { |
1687 | if (!Permissions.BypassPermissions()) | 1696 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1688 | { | 1697 | { |
1689 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1698 | List<UUID> uuids = new List<UUID>(); |
1690 | { | 1699 | uuids.Add(itemID); |
1691 | List<UUID> uuids = new List<UUID>(); | 1700 | RemoveInventoryItem(remoteClient, uuids); |
1692 | uuids.Add(itemID); | ||
1693 | RemoveInventoryItem(remoteClient, uuids); | ||
1694 | } | ||
1695 | } | ||
1696 | } | ||
1697 | else | ||
1698 | { | ||
1699 | m_log.ErrorFormat( | ||
1700 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | ||
1701 | itemID, remoteClient.Name); | ||
1702 | } | ||
1703 | } | 1701 | } |
1704 | } | 1702 | } |
1705 | else // Updating existing item with new perms etc | 1703 | } |
1706 | { | 1704 | else // Updating existing item with new perms etc |
1705 | { | ||
1707 | // m_log.DebugFormat( | 1706 | // m_log.DebugFormat( |
1708 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", | 1707 | // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", |
1709 | // currentItem.Name, part.Name); | 1708 | // currentItem.Name, part.Name); |
1710 | 1709 | ||
1711 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the | 1710 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1712 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) | 1711 | return; |
1713 | // will not pass in a transaction ID in the update message. | 1712 | |
1714 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) | 1713 | // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the |
1715 | { | 1714 | // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) |
1716 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1715 | // will not pass in a transaction ID in the update message. |
1717 | remoteClient, part, transactionID, currentItem); | 1716 | if (transactionID != UUID.Zero && AgentTransactionsModule != null) |
1717 | { | ||
1718 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | ||
1719 | remoteClient, part, transactionID, currentItem); | ||
1718 | 1720 | ||
1719 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1721 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1720 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1722 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
@@ -1722,49 +1724,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | // remoteClient.SendAgentAlertMessage("Script saved", false); | 1724 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1723 | // else | 1725 | // else |
1724 | // remoteClient.SendAgentAlertMessage("Item saved", false); | 1726 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1725 | } | 1727 | } |
1726 | 1728 | ||
1727 | // Base ALWAYS has move | 1729 | // Base ALWAYS has move |
1728 | currentItem.BasePermissions |= (uint)PermissionMask.Move; | 1730 | currentItem.BasePermissions |= (uint)PermissionMask.Move; |
1729 | 1731 | ||
1730 | itemInfo.Flags = currentItem.Flags; | 1732 | itemInfo.Flags = currentItem.Flags; |
1731 | 1733 | ||
1732 | // Check if we're allowed to mess with permissions | 1734 | // Check if we're allowed to mess with permissions |
1733 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god | 1735 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god |
1736 | { | ||
1737 | if (remoteClient.AgentId != part.OwnerID) // Not owner | ||
1734 | { | 1738 | { |
1735 | if (remoteClient.AgentId != part.OwnerID) // Not owner | 1739 | // Friends and group members can't change any perms |
1736 | { | 1740 | itemInfo.BasePermissions = currentItem.BasePermissions; |
1737 | // Friends and group members can't change any perms | 1741 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; |
1738 | itemInfo.BasePermissions = currentItem.BasePermissions; | 1742 | itemInfo.GroupPermissions = currentItem.GroupPermissions; |
1739 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; | 1743 | itemInfo.NextPermissions = currentItem.NextPermissions; |
1740 | itemInfo.GroupPermissions = currentItem.GroupPermissions; | 1744 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; |
1741 | itemInfo.NextPermissions = currentItem.NextPermissions; | ||
1742 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; | ||
1743 | } | ||
1744 | else | ||
1745 | { | ||
1746 | // Owner can't change base, and can change other | ||
1747 | // only up to base | ||
1748 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1749 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1750 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1751 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1752 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1753 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1754 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1755 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1756 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1757 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1758 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1759 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1760 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1761 | } | ||
1762 | |||
1763 | } | 1745 | } |
1764 | else | 1746 | else |
1765 | { | 1747 | { |
1766 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | 1748 | // Owner can't change base, and can change other |
1767 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | 1749 | // only up to base |
1750 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1768 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | 1751 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) |
1769 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | 1752 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; |
1770 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | 1753 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) |
@@ -1773,24 +1756,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1773 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | 1756 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; |
1774 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | 1757 | if (itemInfo.NextPermissions != currentItem.NextPermissions) |
1775 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | 1758 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; |
1759 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1760 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1761 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1762 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1776 | } | 1763 | } |
1777 | 1764 | ||
1778 | // Next ALWAYS has move | 1765 | } |
1779 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; | 1766 | else |
1767 | { | ||
1768 | if (itemInfo.BasePermissions != currentItem.BasePermissions) | ||
1769 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase; | ||
1770 | if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions) | ||
1771 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; | ||
1772 | if (itemInfo.GroupPermissions != currentItem.GroupPermissions) | ||
1773 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; | ||
1774 | if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions) | ||
1775 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner; | ||
1776 | if (itemInfo.NextPermissions != currentItem.NextPermissions) | ||
1777 | itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; | ||
1778 | } | ||
1779 | |||
1780 | // Next ALWAYS has move | ||
1781 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; | ||
1780 | 1782 | ||
1781 | if (part.Inventory.UpdateInventoryItem(itemInfo)) | 1783 | if (part.Inventory.UpdateInventoryItem(itemInfo)) |
1782 | { | 1784 | { |
1783 | part.SendPropertiesToClient(remoteClient); | 1785 | part.SendPropertiesToClient(remoteClient); |
1784 | } | ||
1785 | } | 1786 | } |
1786 | } | 1787 | } |
1787 | else | ||
1788 | { | ||
1789 | m_log.WarnFormat( | ||
1790 | "[PRIM INVENTORY]: " + | ||
1791 | "Update with item {0} requested of prim {1} for {2} but this prim does not exist", | ||
1792 | itemID, primLocalID, remoteClient.Name); | ||
1793 | } | ||
1794 | } | 1788 | } |
1795 | 1789 | ||
1796 | /// <summary> | 1790 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 968b298..4630497 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -87,6 +87,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
87 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); | 87 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); |
88 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 88 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
89 | public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart); | 89 | public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart); |
90 | public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart); | ||
90 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 91 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
91 | public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 92 | public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
92 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); | 93 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); |
@@ -160,6 +161,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | public event CreateObjectInventoryHandler OnCreateObjectInventory; | 161 | public event CreateObjectInventoryHandler OnCreateObjectInventory; |
161 | public event CopyObjectInventoryHandler OnCopyObjectInventory; | 162 | public event CopyObjectInventoryHandler OnCopyObjectInventory; |
162 | public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv; | 163 | public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv; |
164 | public event DoDropInObjectInv OnDropInObjectInv; | ||
163 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; | 165 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; |
164 | public event TransferObjectInventoryHandler OnTransferObjectInventory; | 166 | public event TransferObjectInventoryHandler OnTransferObjectInventory; |
165 | public event CreateUserInventoryHandler OnCreateUserInventory; | 167 | public event CreateUserInventoryHandler OnCreateUserInventory; |
@@ -1109,6 +1111,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1109 | return true; | 1111 | return true; |
1110 | } | 1112 | } |
1111 | 1113 | ||
1114 | public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart) | ||
1115 | { | ||
1116 | DoDropInObjectInv handler = OnDropInObjectInv; | ||
1117 | if (handler != null) | ||
1118 | { | ||
1119 | if (client == null || client.SceneAgent == null|| destPart == null || item == null) | ||
1120 | return false; | ||
1121 | |||
1122 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
1123 | if(sp == null || sp.IsDeleted) | ||
1124 | return false; | ||
1125 | |||
1126 | Delegate[] list = handler.GetInvocationList(); | ||
1127 | foreach (DoDropInObjectInv h in list) | ||
1128 | { | ||
1129 | if (h(item, sp, destPart) == false) | ||
1130 | return false; | ||
1131 | } | ||
1132 | } | ||
1133 | return true; | ||
1134 | } | ||
1135 | |||
1112 | public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) | 1136 | public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) |
1113 | { | 1137 | { |
1114 | DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; | 1138 | DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; |