diff options
author | Melanie | 2010-03-09 23:10:14 +0000 |
---|---|---|
committer | Melanie | 2010-03-09 23:11:28 +0000 |
commit | 88771aeed3d45e60a18aa9a810eeb37b8e5def12 (patch) | |
tree | 6e914b1dde29b032d683915efebbc2d1787d9880 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-88771aeed3d45e60a18aa9a810eeb37b8e5def12.zip opensim-SC-88771aeed3d45e60a18aa9a810eeb37b8e5def12.tar.gz opensim-SC-88771aeed3d45e60a18aa9a810eeb37b8e5def12.tar.bz2 opensim-SC-88771aeed3d45e60a18aa9a810eeb37b8e5def12.tar.xz |
Cache UserLevel in ScenePresence on SP creation. Change IsAdministrator
to use that stored value.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 28 |
2 files changed, 27 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 2211f3e..845c4c2 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -490,6 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
490 | 490 | ||
491 | if (m_allowGridGods) | 491 | if (m_allowGridGods) |
492 | { | 492 | { |
493 | ScenePresence sp = m_scene.GetScenePresence(user); | ||
494 | if (sp != null) | ||
495 | { | ||
496 | if (sp.UserLevel >= 200) | ||
497 | return true; | ||
498 | return false; | ||
499 | } | ||
500 | |||
493 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); | 501 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); |
494 | if (account != null) | 502 | if (account != null) |
495 | { | 503 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4256be9..7661f1e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -146,7 +146,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
146 | 146 | ||
147 | private float m_sitAvatarHeight = 2.0f; | 147 | private float m_sitAvatarHeight = 2.0f; |
148 | 148 | ||
149 | private float m_godlevel; | 149 | private int m_godLevel; |
150 | private int m_userLevel; | ||
150 | 151 | ||
151 | private bool m_invulnerable = true; | 152 | private bool m_invulnerable = true; |
152 | 153 | ||
@@ -294,9 +295,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
294 | get { return m_invulnerable; } | 295 | get { return m_invulnerable; } |
295 | } | 296 | } |
296 | 297 | ||
297 | public float GodLevel | 298 | public int UserLevel |
298 | { | 299 | { |
299 | get { return m_godlevel; } | 300 | get { return m_userLevel; } |
301 | } | ||
302 | |||
303 | public int GodLevel | ||
304 | { | ||
305 | get { return m_godLevel; } | ||
300 | } | 306 | } |
301 | 307 | ||
302 | public ulong RegionHandle | 308 | public ulong RegionHandle |
@@ -668,6 +674,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
668 | m_regionInfo = reginfo; | 674 | m_regionInfo = reginfo; |
669 | m_localId = m_scene.AllocateLocalId(); | 675 | m_localId = m_scene.AllocateLocalId(); |
670 | 676 | ||
677 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | ||
678 | |||
679 | m_userLevel = account.UserLevel; | ||
680 | |||
671 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 681 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
672 | if (gm != null) | 682 | if (gm != null) |
673 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 683 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
@@ -2967,17 +2977,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2967 | if (account != null) | 2977 | if (account != null) |
2968 | { | 2978 | { |
2969 | if (account.UserLevel > 0) | 2979 | if (account.UserLevel > 0) |
2970 | m_godlevel = account.UserLevel; | 2980 | m_godLevel = account.UserLevel; |
2971 | else | 2981 | else |
2972 | m_godlevel = 200; | 2982 | m_godLevel = 200; |
2973 | } | 2983 | } |
2974 | } | 2984 | } |
2975 | else | 2985 | else |
2976 | { | 2986 | { |
2977 | m_godlevel = 0; | 2987 | m_godLevel = 0; |
2978 | } | 2988 | } |
2979 | 2989 | ||
2980 | ControllingClient.SendAdminResponse(token, (uint)m_godlevel); | 2990 | ControllingClient.SendAdminResponse(token, (uint)m_godLevel); |
2981 | } | 2991 | } |
2982 | 2992 | ||
2983 | #region Child Agent Updates | 2993 | #region Child Agent Updates |
@@ -3068,7 +3078,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3068 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 3078 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
3069 | 3079 | ||
3070 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3080 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3071 | cAgent.GodLevel = (byte)m_godlevel; | 3081 | cAgent.GodLevel = (byte)m_godLevel; |
3072 | else | 3082 | else |
3073 | cAgent.GodLevel = (byte) 0; | 3083 | cAgent.GodLevel = (byte) 0; |
3074 | 3084 | ||
@@ -3157,7 +3167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3157 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 3167 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
3158 | 3168 | ||
3159 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3169 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3160 | m_godlevel = cAgent.GodLevel; | 3170 | m_godLevel = cAgent.GodLevel; |
3161 | m_setAlwaysRun = cAgent.AlwaysRun; | 3171 | m_setAlwaysRun = cAgent.AlwaysRun; |
3162 | 3172 | ||
3163 | uint i = 0; | 3173 | uint i = 0; |