Cache UserLevel in ScenePresence on SP creation. Change IsAdministrator

to use that stored value.
avinationmerge
Melanie 2010-03-09 23:10:14 +00:00
parent 40873504dc
commit 689514a40a
2 changed files with 27 additions and 9 deletions

View File

@ -490,6 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_allowGridGods) if (m_allowGridGods)
{ {
ScenePresence sp = m_scene.GetScenePresence(user);
if (sp != null)
{
if (sp.UserLevel >= 200)
return true;
return false;
}
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user);
if (account != null) if (account != null)
{ {

View File

@ -150,7 +150,8 @@ namespace OpenSim.Region.Framework.Scenes
private float m_sitAvatarHeight = 2.0f; private float m_sitAvatarHeight = 2.0f;
private float m_godlevel; private int m_godLevel;
private int m_userLevel;
private bool m_invulnerable = true; private bool m_invulnerable = true;
@ -304,9 +305,14 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_invulnerable; } get { return m_invulnerable; }
} }
public float GodLevel public int UserLevel
{ {
get { return m_godlevel; } get { return m_userLevel; }
}
public int GodLevel
{
get { return m_godLevel; }
} }
public ulong RegionHandle public ulong RegionHandle
@ -678,6 +684,10 @@ namespace OpenSim.Region.Framework.Scenes
m_regionInfo = reginfo; m_regionInfo = reginfo;
m_localId = m_scene.AllocateLocalId(); m_localId = m_scene.AllocateLocalId();
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
m_userLevel = account.UserLevel;
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
if (gm != null) if (gm != null)
m_grouptitle = gm.GetGroupTitle(m_uuid); m_grouptitle = gm.GetGroupTitle(m_uuid);
@ -3164,17 +3174,17 @@ namespace OpenSim.Region.Framework.Scenes
if (account != null) if (account != null)
{ {
if (account.UserLevel > 0) if (account.UserLevel > 0)
m_godlevel = account.UserLevel; m_godLevel = account.UserLevel;
else else
m_godlevel = 200; m_godLevel = 200;
} }
} }
else else
{ {
m_godlevel = 0; m_godLevel = 0;
} }
ControllingClient.SendAdminResponse(token, (uint)m_godlevel); ControllingClient.SendAdminResponse(token, (uint)m_godLevel);
} }
#region Child Agent Updates #region Child Agent Updates
@ -3265,7 +3275,7 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.ControlFlags = (uint)m_AgentControlFlags; cAgent.ControlFlags = (uint)m_AgentControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
cAgent.GodLevel = (byte)m_godlevel; cAgent.GodLevel = (byte)m_godLevel;
else else
cAgent.GodLevel = (byte) 0; cAgent.GodLevel = (byte) 0;
@ -3354,7 +3364,7 @@ namespace OpenSim.Region.Framework.Scenes
m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
m_godlevel = cAgent.GodLevel; m_godLevel = cAgent.GodLevel;
m_setAlwaysRun = cAgent.AlwaysRun; m_setAlwaysRun = cAgent.AlwaysRun;
uint i = 0; uint i = 0;