diff options
author | Melanie | 2010-03-09 23:10:14 +0000 |
---|---|---|
committer | Melanie | 2010-03-09 23:12:10 +0000 |
commit | 689514a40a52d71f9cfaaedbb295a57b1d7c728a (patch) | |
tree | 9970f49cb82a699c5283218451782cdf4937f6fc /OpenSim/Region | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC-689514a40a52d71f9cfaaedbb295a57b1d7c728a.zip opensim-SC-689514a40a52d71f9cfaaedbb295a57b1d7c728a.tar.gz opensim-SC-689514a40a52d71f9cfaaedbb295a57b1d7c728a.tar.bz2 opensim-SC-689514a40a52d71f9cfaaedbb295a57b1d7c728a.tar.xz |
Cache UserLevel in ScenePresence on SP creation. Change IsAdministrator
to use that stored value.
Diffstat (limited to 'OpenSim/Region')
-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 93e66e0..f1be4d8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -150,7 +150,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | 150 | ||
151 | private float m_sitAvatarHeight = 2.0f; | 151 | private float m_sitAvatarHeight = 2.0f; |
152 | 152 | ||
153 | private float m_godlevel; | 153 | private int m_godLevel; |
154 | private int m_userLevel; | ||
154 | 155 | ||
155 | private bool m_invulnerable = true; | 156 | private bool m_invulnerable = true; |
156 | 157 | ||
@@ -304,9 +305,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
304 | get { return m_invulnerable; } | 305 | get { return m_invulnerable; } |
305 | } | 306 | } |
306 | 307 | ||
307 | public float GodLevel | 308 | public int UserLevel |
308 | { | 309 | { |
309 | get { return m_godlevel; } | 310 | get { return m_userLevel; } |
311 | } | ||
312 | |||
313 | public int GodLevel | ||
314 | { | ||
315 | get { return m_godLevel; } | ||
310 | } | 316 | } |
311 | 317 | ||
312 | public ulong RegionHandle | 318 | public ulong RegionHandle |
@@ -678,6 +684,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
678 | m_regionInfo = reginfo; | 684 | m_regionInfo = reginfo; |
679 | m_localId = m_scene.AllocateLocalId(); | 685 | m_localId = m_scene.AllocateLocalId(); |
680 | 686 | ||
687 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | ||
688 | |||
689 | m_userLevel = account.UserLevel; | ||
690 | |||
681 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 691 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
682 | if (gm != null) | 692 | if (gm != null) |
683 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 693 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
@@ -3164,17 +3174,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3164 | if (account != null) | 3174 | if (account != null) |
3165 | { | 3175 | { |
3166 | if (account.UserLevel > 0) | 3176 | if (account.UserLevel > 0) |
3167 | m_godlevel = account.UserLevel; | 3177 | m_godLevel = account.UserLevel; |
3168 | else | 3178 | else |
3169 | m_godlevel = 200; | 3179 | m_godLevel = 200; |
3170 | } | 3180 | } |
3171 | } | 3181 | } |
3172 | else | 3182 | else |
3173 | { | 3183 | { |
3174 | m_godlevel = 0; | 3184 | m_godLevel = 0; |
3175 | } | 3185 | } |
3176 | 3186 | ||
3177 | ControllingClient.SendAdminResponse(token, (uint)m_godlevel); | 3187 | ControllingClient.SendAdminResponse(token, (uint)m_godLevel); |
3178 | } | 3188 | } |
3179 | 3189 | ||
3180 | #region Child Agent Updates | 3190 | #region Child Agent Updates |
@@ -3265,7 +3275,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3265 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 3275 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
3266 | 3276 | ||
3267 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3277 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3268 | cAgent.GodLevel = (byte)m_godlevel; | 3278 | cAgent.GodLevel = (byte)m_godLevel; |
3269 | else | 3279 | else |
3270 | cAgent.GodLevel = (byte) 0; | 3280 | cAgent.GodLevel = (byte) 0; |
3271 | 3281 | ||
@@ -3354,7 +3364,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3354 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 3364 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
3355 | 3365 | ||
3356 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3366 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3357 | m_godlevel = cAgent.GodLevel; | 3367 | m_godLevel = cAgent.GodLevel; |
3358 | m_setAlwaysRun = cAgent.AlwaysRun; | 3368 | m_setAlwaysRun = cAgent.AlwaysRun; |
3359 | 3369 | ||
3360 | uint i = 0; | 3370 | uint i = 0; |