mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Make ban, eject, freeze and the scripted versions of those work.
This commit is contained in:
@@ -508,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
|
||||
uint flags, int landLocalID, UUID transactionID, int sequenceID,
|
||||
int sections, List<ParcelManager.ParcelAccessEntry> entries,
|
||||
int sections, List<LandAccessEntry> entries,
|
||||
IClientAPI remote_client)
|
||||
{
|
||||
// Flags is the list to update, it can mean either the ban or
|
||||
@@ -1777,10 +1777,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
if ((flags & 1) != 0) // Ban TODO: Remove magic number
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = targetAvatar.UUID;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
entry.Expires = 0; // Perm
|
||||
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
}
|
||||
|
||||
@@ -467,21 +467,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public bool IsBannedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
|
||||
{
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Ban)
|
||||
return true;
|
||||
return false;
|
||||
}) != -1 && LandData.OwnerID != avatar)
|
||||
}) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -491,21 +496,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public bool IsRestrictedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
|
||||
{
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1 && LandData.OwnerID != avatar)
|
||||
}) == -1)
|
||||
{
|
||||
if (!HasGroupAccess(avatar))
|
||||
{
|
||||
@@ -570,19 +580,24 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
#region AccessList Functions
|
||||
|
||||
public List<UUID> CreateAccessListArrayByFlag(AccessList flag)
|
||||
public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag)
|
||||
{
|
||||
List<UUID> list = new List<UUID>();
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
|
||||
ExpireAccessList();
|
||||
|
||||
List<LandAccessEntry> list = new List<LandAccessEntry>();
|
||||
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == flag)
|
||||
{
|
||||
list.Add(entry.AgentID);
|
||||
}
|
||||
list.Add(entry);
|
||||
}
|
||||
if (list.Count == 0)
|
||||
{
|
||||
list.Add(UUID.Zero);
|
||||
LandAccessEntry e = new LandAccessEntry();
|
||||
e.AgentID = UUID.Zero;
|
||||
e.Flags = 0;
|
||||
e.Expires = 0;
|
||||
|
||||
list.Add(e);
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -594,20 +609,20 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
|
||||
{
|
||||
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access);
|
||||
remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID);
|
||||
List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access);
|
||||
remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID);
|
||||
}
|
||||
|
||||
if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
|
||||
{
|
||||
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban);
|
||||
remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID);
|
||||
List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban);
|
||||
remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAccessList(uint flags, UUID transactionID,
|
||||
int sequenceID, int sections,
|
||||
List<ParcelManager.ParcelAccessEntry> entries,
|
||||
List<LandAccessEntry> entries,
|
||||
IClientAPI remote_client)
|
||||
{
|
||||
LandData newData = LandData.Copy();
|
||||
@@ -617,16 +632,16 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
m_listTransactions[flags] = transactionID;
|
||||
|
||||
List<ParcelManager.ParcelAccessEntry> toRemove =
|
||||
new List<ParcelManager.ParcelAccessEntry>();
|
||||
List<LandAccessEntry> toRemove =
|
||||
new List<LandAccessEntry>();
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in newData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == (AccessList)flags)
|
||||
toRemove.Add(entry);
|
||||
}
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
|
||||
foreach (LandAccessEntry entry in toRemove)
|
||||
{
|
||||
newData.ParcelAccessList.Remove(entry);
|
||||
}
|
||||
@@ -641,13 +656,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in entries)
|
||||
foreach (LandAccessEntry entry in entries)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry temp =
|
||||
new ParcelManager.ParcelAccessEntry();
|
||||
LandAccessEntry temp =
|
||||
new LandAccessEntry();
|
||||
|
||||
temp.AgentID = entry.AgentID;
|
||||
temp.Time = entry.Time;
|
||||
temp.Expires = entry.Expires;
|
||||
temp.Flags = (AccessList)flags;
|
||||
|
||||
newData.ParcelAccessList.Add(temp);
|
||||
@@ -1164,5 +1179,20 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void ExpireAccessList()
|
||||
{
|
||||
List<LandAccessEntry> delete = new List<LandAccessEntry>();
|
||||
|
||||
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
|
||||
{
|
||||
if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch())
|
||||
delete.Add(entry);
|
||||
}
|
||||
foreach (LandAccessEntry entry in delete)
|
||||
LandData.ParcelAccessList.Remove(entry);
|
||||
|
||||
m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user