Add userFlags check to isBanned. This checks bans against DenyAnonymous and DenyMinors. Note that the ban doesn't actually work yet due to some stuff mel's working on .
parent
04c62c4959
commit
3ecf712e4d
|
@ -338,11 +338,30 @@ namespace OpenSim.Framework
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool IsBanned(UUID avatarID)
|
||||
public bool IsBanned(UUID avatarID, int userFlags)
|
||||
{
|
||||
foreach (EstateBan ban in l_EstateBans)
|
||||
if (ban.BannedUserID == avatarID)
|
||||
return true;
|
||||
|
||||
if (!IsEstateManager(avatarID) && !HasAccess(avatarID))
|
||||
{
|
||||
if (DenyMinors)
|
||||
{
|
||||
if ((userFlags & 32) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (DenyAnonymous)
|
||||
{
|
||||
if ((userFlags & 4) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -350,7 +369,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
if (ban == null)
|
||||
return;
|
||||
if (!IsBanned(ban.BannedUserID))
|
||||
if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
|
||||
l_EstateBans.Add(ban);
|
||||
}
|
||||
|
||||
|
|
|
@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests
|
|||
BannedHostNameMask = string.Empty,
|
||||
BannedUserID = bannedUserId}
|
||||
);
|
||||
Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not.");
|
||||
Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is.");
|
||||
Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not.");
|
||||
Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is.");
|
||||
|
||||
es.RemoveBan(bannedUserId);
|
||||
|
||||
Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is.");
|
||||
Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is.");
|
||||
|
||||
es.AddEstateManager(UUID.Zero);
|
||||
|
||||
|
|
|
@ -88,7 +88,13 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
|
||||
public void AddCapsHandler(UUID agentId)
|
||||
{
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
||||
int flags = 0;
|
||||
ScenePresence sp;
|
||||
if (m_scene.TryGetScenePresence(agentId, out sp))
|
||||
{
|
||||
flags = sp.UserFlags;
|
||||
}
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
|
||||
return;
|
||||
|
||||
String capsObjectPath = GetCapsPath(agentId);
|
||||
|
|
|
@ -2443,7 +2443,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// If the user is banned, we won't let any of their objects
|
||||
// enter. Period.
|
||||
//
|
||||
if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
|
||||
int flags = 0;
|
||||
ScenePresence sp;
|
||||
if (TryGetScenePresence(sceneObject.OwnerID, out sp))
|
||||
{
|
||||
flags = sp.UserFlags;
|
||||
}
|
||||
|
||||
|
||||
if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags))
|
||||
{
|
||||
m_log.Info("[INTERREGION]: Denied prim crossing for " +
|
||||
"banned avatar");
|
||||
|
@ -2472,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectPart RootPrim = sceneObject.RootPart;
|
||||
|
||||
// Fix up attachment Parent Local ID
|
||||
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
|
||||
sp = GetScenePresence(sceneObject.OwnerID);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
|
@ -3617,8 +3625,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (m_regInfo.EstateSettings != null)
|
||||
{
|
||||
if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID))
|
||||
int flags = 0;
|
||||
ScenePresence sp;
|
||||
if (TryGetScenePresence(agent.AgentID, out sp))
|
||||
{
|
||||
flags = sp.UserFlags;
|
||||
}
|
||||
if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags))
|
||||
{
|
||||
//Add some more info to help users
|
||||
if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 32))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires age verification",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Denied access to region (0): Region requires age verification");
|
||||
return false;
|
||||
}
|
||||
if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 4))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires payment info on file",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Denied access to region (0): Region requires payment info on file");
|
||||
return false;
|
||||
}
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
reason = String.Format("Denied access to region {0}: You have been banned from that region.",
|
||||
|
@ -3807,7 +3836,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// We have to wait until the viewer contacts this region after receiving EAC.
|
||||
// That calls AddNewClient, which finally creates the ScenePresence
|
||||
if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID))
|
||||
int flags = 0;
|
||||
ScenePresence sp;
|
||||
if (TryGetScenePresence(cAgentData.AgentID, out sp))
|
||||
{
|
||||
flags = sp.UserFlags;
|
||||
}
|
||||
if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags))
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID);
|
||||
return false;
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
get { return m_attachments; }
|
||||
}
|
||||
|
||||
protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
|
||||
|
||||
private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>();
|
||||
|
@ -136,6 +137,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private bool m_updateflag;
|
||||
private byte m_movementflag;
|
||||
private Vector3? m_forceToApply;
|
||||
private int m_userFlags;
|
||||
public int UserFlags
|
||||
{
|
||||
get { return m_userFlags; }
|
||||
}
|
||||
|
||||
private uint m_requestedSitTargetID;
|
||||
private UUID m_requestedSitTargetUUID;
|
||||
public bool SitGround = false;
|
||||
|
@ -763,6 +770,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_localId = m_scene.AllocateLocalId();
|
||||
|
||||
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
|
||||
m_userFlags = account.UserFlags;
|
||||
|
||||
if (account != null)
|
||||
m_userLevel = account.UserLevel;
|
||||
|
|
Loading…
Reference in New Issue