From 10a37f5be4dd61607e6cc3f47cc356dd26cf504d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Sep 2010 02:08:55 +0200 Subject: Refactor script create permission into the perms module --- .../World/Permissions/PermissionsModule.cs | 28 ++++++++++++++++++---- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 -------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 573a22a..9d134ac 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1780,10 +1780,28 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - if ((int)InventoryType.LSL == invType) - if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID)) - return false; - + SceneObjectPart part = scene.GetSceneObjectPart(objectID); + ScenePresence p = scene.GetScenePresence(userID); + + if (part == null || p == null) + return false; + + if (!IsAdministrator(userID)) + { + if (part.OwnerID != userID) + { + // Group permissions + if ((part.GroupID == UUID.Zero) || (p.ControllingClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0)) + return false; + } else { + if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) + return false; + } + if ((int)InventoryType.LSL == invType) + if (m_allowedScriptCreators == UserSet.Administrators) + return false; + } + return true; } @@ -1980,4 +1998,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions return false; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8011154..d3a1447 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1533,16 +1533,6 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - if (part.OwnerID != remoteClient.AgentId) - { - // Group permissions - if ((part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0)) - return; - } else { - if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) - return; - } - if (!Permissions.CanCreateObjectInventory( itemBase.InvType, part.UUID, remoteClient.AgentId)) return; -- cgit v1.1