Restructure god level and permissions

Create a class GodController which controls all aspects of god level,
viewer modes and user levels at ScenePresence level.
melanie
Melanie Thielker 2017-01-06 00:55:14 +00:00
parent 46bffad558
commit ad8915f154
22 changed files with 105 additions and 150 deletions

View File

@ -756,7 +756,7 @@ namespace OpenSim.Groups
if (avatar != null) if (avatar != null)
{ {
if (avatar.UserLevel < m_levelGroupCreate) if (avatar.GodController.UserLevel < m_levelGroupCreate)
{ {
remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate)); remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
return UUID.Zero; return UUID.Zero;

View File

@ -89,7 +89,8 @@ namespace OpenSim.Framework
public Vector3 AtAxis; public Vector3 AtAxis;
public Vector3 LeftAxis; public Vector3 LeftAxis;
public Vector3 UpAxis; public Vector3 UpAxis;
public int GodLevel; //public int GodLevel;
public OSD GodData = new OSDMap();
public bool ChangedGrid; public bool ChangedGrid;
// This probably shouldn't be here // This probably shouldn't be here
@ -117,7 +118,13 @@ namespace OpenSim.Framework
args["far"] = OSD.FromReal(Far); args["far"] = OSD.FromReal(Far);
args["changed_grid"] = OSD.FromBoolean(ChangedGrid); args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
args["god_level"] = OSD.FromString(GodLevel.ToString()); //args["god_level"] = OSD.FromString(GodLevel.ToString());
args["god_data"] = GodData;
OSDMap g = (OSDMap)GodData;
// Set legacy value
// TODO: remove after 0.9 is superseded
if (g.ContainsKey("ViewerUiIsGod"))
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
if ((Throttles != null) && (Throttles.Length > 0)) if ((Throttles != null) && (Throttles.Length > 0))
args["throttles"] = OSD.FromBinary(Throttles); args["throttles"] = OSD.FromBinary(Throttles);
@ -176,8 +183,10 @@ namespace OpenSim.Framework
if (args["changed_grid"] != null) if (args["changed_grid"] != null)
ChangedGrid = args["changed_grid"].AsBoolean(); ChangedGrid = args["changed_grid"].AsBoolean();
if (args["god_level"] != null) //if (args["god_level"] != null)
Int32.TryParse(args["god_level"].AsString(), out GodLevel); // Int32.TryParse(args["god_level"].AsString(), out GodLevel);
if (args["god_data"] != null)
GodData = args["god_data"];
if (args["far"] != null) if (args["far"] != null)
Far = (float)(args["far"].AsReal()); Far = (float)(args["far"].AsReal());
@ -353,7 +362,8 @@ namespace OpenSim.Framework
public Quaternion BodyRotation; public Quaternion BodyRotation;
public uint ControlFlags; public uint ControlFlags;
public float EnergyLevel; public float EnergyLevel;
public Byte GodLevel; public OSD GodData = new OSDMap();
//public Byte GodLevel;
public bool AlwaysRun; public bool AlwaysRun;
public UUID PreyAgent; public UUID PreyAgent;
public Byte AgentAccess; public Byte AgentAccess;
@ -427,7 +437,11 @@ namespace OpenSim.Framework
args["control_flags"] = OSD.FromString(ControlFlags.ToString()); args["control_flags"] = OSD.FromString(ControlFlags.ToString());
args["energy_level"] = OSD.FromReal(EnergyLevel); args["energy_level"] = OSD.FromReal(EnergyLevel);
args["god_level"] = OSD.FromString(GodLevel.ToString()); //args["god_level"] = OSD.FromString(GodLevel.ToString());
args["god_data"] = GodData;
OSDMap g = (OSDMap)GodData;
if (g.ContainsKey("ViewerUiIsGod"))
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
args["always_run"] = OSD.FromBoolean(AlwaysRun); args["always_run"] = OSD.FromBoolean(AlwaysRun);
args["prey_agent"] = OSD.FromUUID(PreyAgent); args["prey_agent"] = OSD.FromUUID(PreyAgent);
args["agent_access"] = OSD.FromString(AgentAccess.ToString()); args["agent_access"] = OSD.FromString(AgentAccess.ToString());
@ -605,8 +619,11 @@ namespace OpenSim.Framework
if (args["energy_level"] != null) if (args["energy_level"] != null)
EnergyLevel = (float)(args["energy_level"].AsReal()); EnergyLevel = (float)(args["energy_level"].AsReal());
if (args["god_level"] != null) //if (args["god_level"] != null)
Byte.TryParse(args["god_level"].AsString(), out GodLevel); // Byte.TryParse(args["god_level"].AsString(), out GodLevel);
if (args["god_data"] != null)
GodData = args["god_data"];
if (args["always_run"] != null) if (args["always_run"] != null)
AlwaysRun = args["always_run"].AsBoolean(); AlwaysRun = args["always_run"].AsBoolean();

View File

@ -537,7 +537,7 @@ namespace OpenSim.Region.ClientStack.Linden
// check user level // check user level
if (avatar != null) if (avatar != null)
{ {
if (avatar.UserLevel < m_levelUpload) if (avatar.GodController.UserLevel < m_levelUpload)
{ {
LLSDAssetUploadError resperror = new LLSDAssetUploadError(); LLSDAssetUploadError resperror = new LLSDAssetUploadError();
resperror.message = "Insufficient permissions to upload"; resperror.message = "Insufficient permissions to upload";

View File

@ -11455,7 +11455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ScenePresence p; ScenePresence p;
if (scene.TryGetScenePresence(sender.AgentId, out p)) if (scene.TryGetScenePresence(sender.AgentId, out p))
{ {
if (p.GodLevel >= 200) if (p.GodController.GodLevel >= 200)
{ {
groupProfileReply.GroupData.OpenEnrollment = true; groupProfileReply.GroupData.OpenEnrollment = true;
groupProfileReply.GroupData.MembershipFee = 0; groupProfileReply.GroupData.MembershipFee = 0;

View File

@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
// check user level // check user level
if (avatar != null) if (avatar != null)
{ {
if (avatar.UserLevel < m_levelUpload) if (avatar.GodController.UserLevel < m_levelUpload)
{ {
remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false);
return; return;

View File

@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromPos = avatar.AbsolutePosition; fromPos = avatar.AbsolutePosition;
fromName = avatar.Name; fromName = avatar.Name;
fromID = c.Sender.AgentId; fromID = c.Sender.AgentId;
if (avatar.GodLevel >= 200) if (avatar.GodController.GodLevel >= 200)
{ // let gods speak to outside or things may get confusing { // let gods speak to outside or things may get confusing
fromNamePrefix = m_adminPrefix; fromNamePrefix = m_adminPrefix;
checkParcelHide = false; checkParcelHide = false;
@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
{ {
if (checkParcelHide) if (checkParcelHide)
{ {
if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodLevel < 200) if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodController.GodLevel < 200)
return; return;
} }
if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)

View File

@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// If we're in god mode, we reverse the meaning. Offer // If we're in god mode, we reverse the meaning. Offer
// calling card becomes "Take a calling card" for that // calling card becomes "Take a calling card" for that
// person, no matter if they agree or not. // person, no matter if they agree or not.
if (sp.GodLevel >= 200) if (sp.GodController.GodLevel >= 200)
{ {
CreateCallingCard(client.AgentId, destID, UUID.Zero, true); CreateCallingCard(client.AgentId, destID, UUID.Zero, true);
return; return;

View File

@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (avatar == null) if (avatar == null)
return; return;
if (avatar.UserLevel < m_levelHGFriends) if (avatar.GodController.UserLevel < m_levelHGFriends)
{ {
client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
return; return;
@ -844,4 +844,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false; return false;
} }
} }
} }

View File

@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
sp.GrantGodlikePowers(token, godLike); sp.GrantGodlikePowers(token, godLike);
if (godLike && sp.GodLevel < 200 && DialogModule != null) if (godLike && sp.GodController.GodLevel < 200 && DialogModule != null)
DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
} }
@ -194,14 +194,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
int godlevel = 200; int godlevel = 200;
// update level so higher gods can kick lower ones // update level so higher gods can kick lower ones
ScenePresence god = m_scene.GetScenePresence(godID); ScenePresence god = m_scene.GetScenePresence(godID);
if(god != null && god.GodLevel > godlevel) if(god != null && god.GodController.GodLevel > godlevel)
godlevel = god.GodLevel; godlevel = god.GodController.GodLevel;
if(agentID == ALL_AGENTS) if(agentID == ALL_AGENTS)
{ {
m_scene.ForEachRootScenePresence(delegate(ScenePresence p) m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
{ {
if (p.UUID != godID && godlevel > p.GodLevel) if (p.UUID != godID && godlevel > p.GodController.GodLevel)
doKickmodes(godID, p, kickflags, reason); doKickmodes(godID, p, kickflags, reason);
}); });
return; return;
@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
return; return;
} }
if (godlevel <= sp.GodLevel) // no god wars if (godlevel <= sp.GodController.GodLevel) // no god wars
return; return;
if(sp.UUID == godID) if(sp.UUID == godID)

View File

@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
GridInstantMessage m; GridInstantMessage m;
if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodController.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid)))
{ {
m = new GridInstantMessage(scene, client.AgentId, m = new GridInstantMessage(scene, client.AgentId,
client.FirstName+" "+client.LastName, targetid, client.FirstName+" "+client.LastName, targetid,

View File

@ -2077,7 +2077,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentpos.Position = sp.AbsolutePosition; agentpos.Position = sp.AbsolutePosition;
agentpos.Velocity = sp.Velocity; agentpos.Velocity = sp.Velocity;
agentpos.RegionHandle = currentRegionHandler; agentpos.RegionHandle = currentRegionHandler;
agentpos.GodLevel = sp.GodLevel; //agentpos.GodLevel = sp.GodLevel;
agentpos.GodData = sp.GodController.State();
agentpos.Throttles = spClient.GetThrottlesPacked(1); agentpos.Throttles = spClient.GetThrottlesPacked(1);
// agentpos.ChildrenCapSeeds = seeds; // agentpos.ChildrenCapSeeds = seeds;

View File

@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
// this user is going to another grid // this user is going to another grid
// for local users, check if HyperGrid teleport is allowed, based on user level // for local users, check if HyperGrid teleport is allowed, based on user level
if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.UserLevel < m_levelHGTeleport) if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.GodController.UserLevel < m_levelHGTeleport)
{ {
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
reason = "Hypergrid teleport not allowed"; reason = "Hypergrid teleport not allowed";

View File

@ -1977,7 +1977,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ScenePresence SP; ScenePresence SP;
((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
if (SP.UserLevel != 0) if (SP.GodController.UserLevel != 0)
{ {
if (flags == 0) //All parcels, scripted or not if (flags == 0) //All parcels, scripted or not
{ {
@ -2043,7 +2043,7 @@ namespace OpenSim.Region.CoreModules.World.Land
((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
System.Threading.Timer Timer; System.Threading.Timer Timer;
if (targetAvatar.UserLevel == 0) if (targetAvatar.GodController.UserLevel == 0)
{ {
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true)) if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))

View File

@ -547,7 +547,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{ {
ScenePresence sp = m_scene.GetScenePresence(user); ScenePresence sp = m_scene.GetScenePresence(user);
if (sp != null) if (sp != null)
return (sp.UserLevel >= 200); return (sp.GodController.UserLevel >= 200);
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

@ -199,6 +199,7 @@ namespace OpenSim.Region.Framework.Scenes
public int UserLevel public int UserLevel
{ {
get { return m_userLevel; } get { return m_userLevel; }
set { m_userLevel = UserLevel; }
} }
public int GodLevel public int GodLevel

View File

@ -316,8 +316,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_seeIntoBannedRegion = false; public bool m_seeIntoBannedRegion = false;
public int MaxUndoCount = 5; public int MaxUndoCount = 5;
public bool AutomaticGodsOption {get; private set; }
public bool SeeIntoRegion { get; set; } public bool SeeIntoRegion { get; set; }
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
@ -1209,9 +1207,6 @@ namespace OpenSim.Region.Framework.Scenes
#endregion Interest Management #endregion Interest Management
AutomaticGodsOption = Util.GetConfigVarFromSections<bool>(config, "automatic_gods",
new string[] { "Startup", "Permissions" }, true);
StatsReporter = new SimStatsReporter(this); StatsReporter = new SimStatsReporter(this);
StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnSendStatsResult += SendSimStatsPackets;

View File

@ -501,21 +501,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_invulnerable; } get { return m_invulnerable; }
} }
private int m_userLevel; public GodController GodController { get; private set; }
public int UserLevel
{
get { return m_userLevel; }
private set { m_userLevel = value; }
}
private int m_godLevel;
public int GodLevel
{
get { return m_godLevel; }
private set { m_godLevel = value; }
}
private ulong m_rootRegionHandle; private ulong m_rootRegionHandle;
private Vector3 m_rootRegionPosition = new Vector3(); private Vector3 m_rootRegionPosition = new Vector3();
@ -1056,21 +1042,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Constructor(s) #region Constructor(s)
private void SetAutoGod()
{
if(!isNPC && m_scene.Permissions.IsGod(m_uuid))
{
m_godLevel = 200;
if(m_godLevel < UserLevel)
m_godLevel = UserLevel;
else
m_godLevel = 0;
}
}
public ScenePresence( public ScenePresence(
IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
{ {
GodController = new GodController(world, this);
m_scene = world; m_scene = world;
AttachmentsSyncLock = new Object(); AttachmentsSyncLock = new Object();
AllowMovement = true; AllowMovement = true;
@ -1097,15 +1073,7 @@ namespace OpenSim.Region.Framework.Scenes
m_userFlags = 0; m_userFlags = 0;
if (account != null) if (account != null)
UserLevel = account.UserLevel; GodController.UserLevel = account.UserLevel;
if(!isNPC && m_scene.AutomaticGodsOption)
{
if(m_scene.Permissions.IsGod(m_uuid))
m_godLevel = 200;
if(m_godLevel < UserLevel)
m_godLevel = UserLevel;
}
// IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
// if (gm != null) // if (gm != null)
@ -2152,8 +2120,6 @@ namespace OpenSim.Region.Framework.Scenes
if(!IsChildAgent && !isNPC) if(!IsChildAgent && !isNPC)
ControllingClient.SendAdminResponse(UUID.Zero, (uint)GodLevel);
// start sending terrain patchs // start sending terrain patchs
if (!gotCrossUpdate && !isNPC) if (!gotCrossUpdate && !isNPC)
Scene.SendLayerData(ControllingClient); Scene.SendLayerData(ControllingClient);
@ -2226,7 +2192,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
SendAppearanceToAgentNF(p); SendAppearanceToAgentNF(p);
@ -2276,7 +2242,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
} }
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
SendAttachmentsToAgentNF(p); SendAttachmentsToAgentNF(p);
@ -3892,7 +3858,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!remoteClient.IsActive) if (!remoteClient.IsActive)
return; return;
if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodController.GodLevel < 200)
return; return;
//m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
@ -4002,7 +3968,7 @@ namespace OpenSim.Region.Framework.Scenes
// get the avatar, then a kill if can't see it // get the avatar, then a kill if can't see it
p.SendInitialAvatarDataToAgent(this); p.SendInitialAvatarDataToAgent(this);
if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodLevel < 200) if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodController.GodLevel < 200)
return; return;
p.SendAppearanceToAgentNF(this); p.SendAppearanceToAgentNF(this);
@ -4050,7 +4016,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ScenePresence p in presences) foreach (ScenePresence p in presences)
{ {
p.ControllingClient.SendAvatarDataImmediate(this); p.ControllingClient.SendAvatarDataImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
// either just kill the object // either just kill the object
// p.ControllingClient.SendKillObject(new List<uint> {LocalId}); // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
// or also attachments viewer may still know about // or also attachments viewer may still know about
@ -4063,7 +4029,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendInitialAvatarDataToAgent(ScenePresence p) public void SendInitialAvatarDataToAgent(ScenePresence p)
{ {
p.ControllingClient.SendAvatarDataImmediate(this); p.ControllingClient.SendAvatarDataImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
// either just kill the object // either just kill the object
// p.ControllingClient.SendKillObject(new List<uint> {LocalId}); // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
// or also attachments viewer may still know about // or also attachments viewer may still know about
@ -4077,7 +4043,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendAvatarDataToAgent(ScenePresence avatar) public void SendAvatarDataToAgent(ScenePresence avatar)
{ {
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200)
return; return;
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
} }
@ -4122,7 +4088,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200)
return; return;
SendAppearanceToAgentNF(avatar); SendAppearanceToAgentNF(avatar);
} }
@ -4138,7 +4104,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent || Animator == null) if (IsChildAgent || Animator == null)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
return; return;
Animator.SendAnimPackToClient(p.ControllingClient); Animator.SendAnimPackToClient(p.ControllingClient);
@ -4149,7 +4115,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent) if (IsChildAgent)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
return; return;
p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
@ -4174,7 +4140,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.ForEachScenePresence(delegate(ScenePresence p) m_scene.ForEachScenePresence(delegate(ScenePresence p)
{ {
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
return; return;
p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
}); });
@ -4287,7 +4253,7 @@ namespace OpenSim.Region.Framework.Scenes
agentpos.Position = AbsolutePosition; agentpos.Position = AbsolutePosition;
agentpos.Velocity = Velocity; agentpos.Velocity = Velocity;
agentpos.RegionHandle = RegionHandle; agentpos.RegionHandle = RegionHandle;
agentpos.GodLevel = GodLevel; agentpos.GodData = GodController.State();
agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);
// Let's get this out of the update loop // Let's get this out of the update loop
@ -4536,23 +4502,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void GrantGodlikePowers(UUID token, bool godStatus) public void GrantGodlikePowers(UUID token, bool godStatus)
{ {
// if(m_scene.AutomaticGodsOption) if (isNPC)
// return; return;
int oldgodlevel = GodLevel; bool success = GodController.RequestGodMode(godStatus);
if (success && godStatus)
if (godStatus && !isNPC && m_scene.Permissions.IsGod(UUID)) parcelGodCheck(m_currentParcelUUID, GodController.GodLevel >= 200);
{
GodLevel = 200;
if(GodLevel < UserLevel)
GodLevel = UserLevel;
}
else
GodLevel = 0;
ControllingClient.SendAdminResponse(token, (uint)GodLevel);
if(oldgodlevel != GodLevel)
parcelGodCheck(m_currentParcelUUID, GodLevel >= 200);
} }
#region Child Agent Updates #region Child Agent Updates
@ -4583,6 +4538,8 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsChildAgent) if (!IsChildAgent)
return; return;
GodController.SetState(cAgentData.GodData);
RegionHandle = cAgentData.RegionHandle; RegionHandle = cAgentData.RegionHandle;
//m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
@ -4597,15 +4554,6 @@ namespace OpenSim.Region.Framework.Scenes
m_pos = cAgentData.Position + offset; m_pos = cAgentData.Position + offset;
CameraPosition = cAgentData.Center + offset; CameraPosition = cAgentData.Center + offset;
if(m_scene.AutomaticGodsOption)
SetAutoGod();
else
{
if(cAgentData.GodLevel >= 200 && m_scene.Permissions.IsGod(m_uuid))
GodLevel = cAgentData.GodLevel;
else
GodLevel = 0;
}
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
{ {
@ -4665,15 +4613,6 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.HeadRotation = m_headrotation; cAgent.HeadRotation = m_headrotation;
cAgent.BodyRotation = Rotation; cAgent.BodyRotation = Rotation;
cAgent.ControlFlags = (uint)m_AgentControlFlags; cAgent.ControlFlags = (uint)m_AgentControlFlags;
if(m_scene.AutomaticGodsOption)
SetAutoGod();
else
{
if (GodLevel >= 200 && m_scene.Permissions.IsGod(cAgent.AgentID))
cAgent.GodLevel = (byte)GodLevel;
else
cAgent.GodLevel = (byte) 0;
}
cAgent.AlwaysRun = SetAlwaysRun; cAgent.AlwaysRun = SetAlwaysRun;
@ -4735,6 +4674,8 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
// Name, m_scene.RegionInfo.RegionName, m_callbackURI); // Name, m_scene.RegionInfo.RegionName, m_callbackURI);
GodController.SetState(cAgent.GodData);
m_pos = cAgent.Position; m_pos = cAgent.Position;
m_velocity = cAgent.Velocity; m_velocity = cAgent.Velocity;
CameraPosition = cAgent.Center; CameraPosition = cAgent.Center;
@ -4771,16 +4712,6 @@ namespace OpenSim.Region.Framework.Scenes
Rotation = cAgent.BodyRotation; Rotation = cAgent.BodyRotation;
m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
if(m_scene.AutomaticGodsOption)
SetAutoGod();
else
{
if (cAgent.GodLevel >= 200 && m_scene.Permissions.IsGod(cAgent.AgentID))
GodLevel = cAgent.GodLevel;
else
GodLevel = 0;
}
SetAlwaysRun = cAgent.AlwaysRun; SetAlwaysRun = cAgent.AlwaysRun;
Appearance = new AvatarAppearance(cAgent.Appearance); Appearance = new AvatarAppearance(cAgent.Appearance);
@ -5010,7 +4941,7 @@ namespace OpenSim.Region.Framework.Scenes
RaiseCollisionScriptEvents(coldata); RaiseCollisionScriptEvents(coldata);
// Gods do not take damage and Invulnerable is set depending on parcel/region flags // Gods do not take damage and Invulnerable is set depending on parcel/region flags
if (Invulnerable || GodLevel > 0) if (Invulnerable || GodController.GodLevel > 0)
return; return;
// The following may be better in the ICombatModule // The following may be better in the ICombatModule
@ -5295,7 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p != this && sog.HasPrivateAttachmentPoint) if (p != this && sog.HasPrivateAttachmentPoint)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
return; return;
SendTerseUpdateToAgentNF(p); SendTerseUpdateToAgentNF(p);
@ -5409,7 +5340,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
p.ControllingClient.SendEntityUpdate(rootpart, rootflag); p.ControllingClient.SendEntityUpdate(rootpart, rootflag);
@ -5468,7 +5399,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
p.ControllingClient.SendEntityUpdate(rootpart, flag); p.ControllingClient.SendEntityUpdate(rootpart, flag);
@ -5518,7 +5449,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
p.ControllingClient.SendEntityUpdate(part, flag); p.ControllingClient.SendEntityUpdate(part, flag);
@ -5559,7 +5490,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200)
continue; continue;
p.ControllingClient.SendEntityUpdate(part, flag); p.ControllingClient.SendEntityUpdate(part, flag);
@ -6197,7 +6128,7 @@ namespace OpenSim.Region.Framework.Scenes
// the TP point. This behaviour mimics agni. // the TP point. This behaviour mimics agni.
if (land.LandData.LandingType == (byte)LandingType.LandingPoint && if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
land.LandData.UserLocation != Vector3.Zero && land.LandData.UserLocation != Vector3.Zero &&
GodLevel < 200 && GodController.GodLevel < 200 &&
((land.LandData.OwnerID != m_uuid && ((land.LandData.OwnerID != m_uuid &&
!m_scene.Permissions.IsGod(m_uuid) && !m_scene.Permissions.IsGod(m_uuid) &&
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
@ -6222,7 +6153,7 @@ namespace OpenSim.Region.Framework.Scenes
string reason; string reason;
// dont mess with gods // dont mess with gods
if(GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid)) if(GodController.GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid))
return true; return true;
// respect region owner and managers // respect region owner and managers
@ -6570,7 +6501,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
// those not on parcel dont see me // those not on parcel dont see me
if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200)
{ {
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
} }
@ -6596,9 +6527,9 @@ namespace OpenSim.Region.Framework.Scenes
// only those on previus parcel need receive kills // only those on previus parcel need receive kills
if (previusParcelID == p.currentParcelUUID) if (previusParcelID == p.currentParcelUUID)
{ {
if(p.GodLevel < 200) if(p.GodController.GodLevel < 200)
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
if(GodLevel < 200) if(GodController.GodLevel < 200)
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p); // i dont see them
} }
// only those on new parcel need see // only those on new parcel need see
@ -6620,7 +6551,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
// those not on new parcel dont see me // those not on new parcel dont see me
if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200)
{ {
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
} }
@ -6646,7 +6577,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue; continue;
// only those old parcel need kills // only those old parcel need kills
if (previusParcelID == p.currentParcelUUID && GodLevel < 200) if (previusParcelID == p.currentParcelUUID && GodController.GodLevel < 200)
{ {
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p); // i dont see them
} }
@ -6709,7 +6640,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Scene.AttachmentsModule != null) if (Scene.AttachmentsModule != null)
Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true);
if (!ParcelHideThisAvatar || GodLevel >= 200) if (!ParcelHideThisAvatar || GodController.GodLevel >= 200)
return; return;
List<ScenePresence> allpresences = m_scene.GetScenePresences(); List<ScenePresence> allpresences = m_scene.GetScenePresences();

View File

@ -877,7 +877,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (avatar != null) if (avatar != null)
{ {
if (avatar.UserLevel < m_levelGroupCreate) if (avatar.GodController.UserLevel < m_levelGroupCreate)
{ {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group."); remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group.");
return UUID.Zero; return UUID.Zero;

View File

@ -4977,7 +4977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null && presence.PresenceType != PresenceType.Npc) if (presence != null && presence.PresenceType != PresenceType.Npc)
{ {
// agent must not be a god // agent must not be a god
if (presence.UserLevel >= 200) return; if (presence.GodController.UserLevel >= 200) return;
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
@ -5029,7 +5029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
{ {
// agent must not be a god // agent must not be a god
if (presence.GodLevel >= 200) return; if (presence.GodController.GodLevel >= 200) return;
// agent must be over the owners land // agent must be over the owners land
ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
@ -5256,7 +5256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
// Pushee is in GodMode this pushing object isn't owned by them // Pushee is in GodMode this pushing object isn't owned by them
if (avatar.GodLevel > 0 && m_host.OwnerID != targetID) if (avatar.GodController.GodLevel > 0 && m_host.OwnerID != targetID)
return; return;
pusheeav = avatar; pusheeav = avatar;
@ -6687,7 +6687,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
delegate (ScenePresence ssp) delegate (ScenePresence ssp)
{ {
// Gods are not listed in SL // Gods are not listed in SL
if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent) if (!ssp.IsDeleted && ssp.GodController.GodLevel == 0.0 && !ssp.IsChildAgent)
{ {
if (!regionWide) if (!regionWide)
{ {

View File

@ -721,7 +721,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.GodLevel < 200) if (sp == null || sp.GodController.GodLevel < 200)
{ {
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0; return 0;
@ -768,7 +768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.GodLevel < 200) if (sp == null || sp.GodController.GodLevel < 200)
{ {
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return; return;
@ -799,7 +799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
ScenePresence sp = World.GetScenePresence(m_host.OwnerID); ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.GodLevel < 200) if (sp == null || sp.GodController.GodLevel < 200)
{ {
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0; return 0;

View File

@ -540,7 +540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
} }
} }
if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) if (presence.IsDeleted || presence.IsChildAgent || presence.GodController.GodLevel > 0.0)
return; return;
// if the object the script is in is attached and the avatar is the owner // if the object the script is in is attached and the avatar is the owner

View File

@ -476,6 +476,16 @@
; you really do not want this... ; you really do not want this...
;parcel_owner_is_god = false ;parcel_owner_is_god = false
; God mode should be turned on in the viewer whenever
; the user has god rights somewhere. They may choose
; to turn it off again, though.
automatic_gods = false
; The user can execute any and all god functions, as
; permitted by the viewer UI, without actually "godding
; up". This is the default state in 0.8.2.
implicit_gods = true
; Control user types that are allowed to create new scripts ; Control user types that are allowed to create new scripts
; Only enforced if serviceside_object_permissions is true ; Only enforced if serviceside_object_permissions is true
; ;