From 9622e8ac72d29b75b96d2dd481671b57d0a204bf Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 19:20:46 +0300 Subject: If a Grid God teleports then include the Godlike teleport flag. This can affect the starting position in the destination region. --- .../EntityTransfer/EntityTransferModule.cs | 6 +++++ .../World/Permissions/PermissionsModule.cs | 31 +++++++++++++++------- .../Region/Framework/Scenes/Scene.Permissions.cs | 17 ++++++++++++ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a318a3c..779fd6b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -161,6 +161,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) { + if (sp.Scene.Permissions.IsGridGod(sp.UUID)) + { + // This user will be a God in the destination scene, too + teleportFlags |= (uint)TeleportFlags.Godlike; + } + if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) return; diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 2032905..7d75fad 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -166,6 +166,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnDeedParcel += CanDeedParcel; m_scene.Permissions.OnDeedObject += CanDeedObject; m_scene.Permissions.OnIsGod += IsGod; + m_scene.Permissions.OnIsGridGod += IsGridGod; m_scene.Permissions.OnIsAdministrator += IsAdministrator; m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED @@ -466,22 +467,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (IsEstateManager(user) && m_RegionManagerIsGod) return true; + if (IsGridGod(user, null)) + return true; + + return false; + } + + /// + /// Is the given user a God throughout the grid (not just in the current scene)? + /// + /// The user + /// Unused, can be null + /// + protected bool IsGridGod(UUID user, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + if (user == UUID.Zero) return false; + if (m_allowGridGods) { ScenePresence sp = m_scene.GetScenePresence(user); if (sp != null) - { - if (sp.UserLevel >= 200) - return true; - return false; - } + return (sp.UserLevel >= 200); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); if (account != null) - { - if (account.UserLevel >= 200) - return true; - } + return (account.UserLevel >= 200); } return false; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..535d87a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -67,6 +67,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); public delegate bool IsGodHandler(UUID user, Scene requestFromScene); + public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); public delegate bool IsAdministratorHandler(UUID user); public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); @@ -134,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes public event RunConsoleCommandHandler OnRunConsoleCommand; public event IssueEstateCommandHandler OnIssueEstateCommand; public event IsGodHandler OnIsGod; + public event IsGridGodHandler OnIsGridGod; public event IsAdministratorHandler OnIsAdministrator; // public event EditParcelHandler OnEditParcel; public event EditParcelPropertiesHandler OnEditParcelProperties; @@ -728,6 +730,21 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public bool IsGridGod(UUID user) + { + IsGridGodHandler handler = OnIsGridGod; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (IsGridGodHandler h in list) + { + if (h(user, m_scene) == false) + return false; + } + } + return true; + } + public bool IsAdministrator(UUID user) { IsAdministratorHandler handler = OnIsAdministrator; -- cgit v1.1