mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
a few changes to Gods ( ie administrators) control
This commit is contained in:
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
if (god == null || god.ControllingClient.SessionId != godSessionID)
|
||||
return String.Empty;
|
||||
|
||||
KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason));
|
||||
KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -162,59 +162,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
}
|
||||
|
||||
public void RequestGodlikePowers(
|
||||
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
|
||||
UUID agentID, UUID sessionID, UUID token, bool godLike)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
if(sp == null || sp.IsDeleted || sp.isNPC)
|
||||
return;
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
if (godLike == false)
|
||||
{
|
||||
sp.GrantGodlikePowers(agentID, sessionID, token, godLike);
|
||||
return;
|
||||
}
|
||||
if (sessionID != sp.ControllingClient.SessionId)
|
||||
return;
|
||||
|
||||
// First check that this is the sim owner
|
||||
if (m_scene.Permissions.IsGod(agentID))
|
||||
{
|
||||
// Next we check for spoofing.....
|
||||
UUID testSessionID = sp.ControllingClient.SessionId;
|
||||
if (sessionID == testSessionID)
|
||||
{
|
||||
if (sessionID == controllingClient.SessionId)
|
||||
{
|
||||
//m_log.Info("godlike: " + godLike.ToString());
|
||||
sp.GrantGodlikePowers(agentID, testSessionID, token, godLike);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DialogModule != null)
|
||||
DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
|
||||
}
|
||||
}
|
||||
sp.GrantGodlikePowers(token, godLike);
|
||||
|
||||
if (godLike && sp.GodLevel < 200 && DialogModule != null)
|
||||
DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kicks User specified from the simulator. This logs them off of the grid
|
||||
/// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes
|
||||
/// that you're kicking it even if the avatar's UUID isn't the UUID that the
|
||||
/// agent is assigned
|
||||
/// Kicks or freezes User specified from the simulator. This logs them off of the grid
|
||||
/// </summary>
|
||||
/// <param name="godID">The person doing the kicking</param>
|
||||
/// <param name="sessionID">The session of the person doing the kicking</param>
|
||||
/// <param name="agentID">the person that is being kicked</param>
|
||||
/// <param name="kickflags">Tells what to do to the user</param>
|
||||
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
|
||||
public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
|
||||
public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason)
|
||||
{
|
||||
if (!m_scene.Permissions.IsGod(godID))
|
||||
// assuming automatic god rights on this for fast griefing reaction
|
||||
// this is also needed for kick via message
|
||||
if(!m_scene.Permissions.IsGod(godID))
|
||||
return;
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
int godlevel = 200;
|
||||
// update level so higher gods can kick lower ones
|
||||
ScenePresence god = m_scene.GetScenePresence(godID);
|
||||
if(god != null && god.GodLevel > godlevel)
|
||||
godlevel = god.GodLevel;
|
||||
|
||||
if (sp == null && agentID != ALL_AGENTS)
|
||||
if(agentID == ALL_AGENTS)
|
||||
{
|
||||
m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
|
||||
{
|
||||
if (p.UUID != godID && godlevel > p.GodLevel)
|
||||
doKickmodes(godID, p, kickflags, reason);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
if (sp == null || sp.IsChildAgent)
|
||||
{
|
||||
IMessageTransferModule transferModule =
|
||||
m_scene.RequestModuleInterface<IMessageTransferModule>();
|
||||
@@ -230,48 +224,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
return;
|
||||
}
|
||||
|
||||
if (godlevel <= sp.GodLevel) // no god wars
|
||||
return;
|
||||
|
||||
if(sp.UUID == godID)
|
||||
return;
|
||||
|
||||
doKickmodes(godID, sp, kickflags, reason);
|
||||
}
|
||||
|
||||
private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason)
|
||||
{
|
||||
switch (kickflags)
|
||||
{
|
||||
case 0:
|
||||
if (sp != null)
|
||||
{
|
||||
case 0:
|
||||
KickPresence(sp, Utils.BytesToString(reason));
|
||||
}
|
||||
else if (agentID == ALL_AGENTS)
|
||||
{
|
||||
m_scene.ForEachRootScenePresence(
|
||||
delegate(ScenePresence p)
|
||||
{
|
||||
if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
|
||||
KickPresence(p, Utils.BytesToString(reason));
|
||||
}
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
case 1:
|
||||
sp.AllowMovement = false;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Frozen");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
case 2:
|
||||
sp.AllowMovement = true;
|
||||
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
|
||||
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void KickPresence(ScenePresence sp, string reason)
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
if(sp.IsDeleted || sp.IsChildAgent)
|
||||
return;
|
||||
sp.ControllingClient.Kick(reason);
|
||||
sp.Scene.CloseAgent(sp.UUID, true);
|
||||
@@ -286,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||
UUID godID = new UUID(msg.fromAgentID);
|
||||
uint kickMode = (uint)msg.binaryBucket[0];
|
||||
|
||||
KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason));
|
||||
KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user