Merge branch 'master' into 0.9.0-post-fixes

0.9.0-post-fixes
Diva Canto 2016-10-24 09:19:21 -07:00
commit e13fb44a39
4 changed files with 482 additions and 346 deletions

View File

@ -46,12 +46,20 @@ namespace OpenSim.Framework
public enum EstateAccessCodex : uint
{
AccessOptions = 1,
AllowedAccess = 1,
AllowedGroups = 2,
EstateBans = 4,
EstateManagers = 8
}
public enum EstateAccessLimits : int
{
AllowedAccess = 500,
AllowedGroups = 63,
EstateBans = 500,
EstateManagers = 10
}
[Flags]public enum TeleportFlags : uint
{
/// <summary>No flags set, or teleport failed</summary>

View File

@ -305,11 +305,17 @@ namespace OpenSim.Framework
OnSave(this);
}
public int EstateUsersCount()
{
return l_EstateAccess.Count;
}
public void AddEstateUser(UUID avatarID)
{
if (avatarID == UUID.Zero)
return;
if (!l_EstateAccess.Contains(avatarID))
if (!l_EstateAccess.Contains(avatarID) &&
(l_EstateAccess.Count < (int)Constants.EstateAccessLimits.AllowedAccess))
l_EstateAccess.Add(avatarID);
}
@ -319,11 +325,17 @@ namespace OpenSim.Framework
l_EstateAccess.Remove(avatarID);
}
public int EstateGroupsCount()
{
return l_EstateGroups.Count;
}
public void AddEstateGroup(UUID avatarID)
{
if (avatarID == UUID.Zero)
return;
if (!l_EstateGroups.Contains(avatarID))
if (!l_EstateGroups.Contains(avatarID) &&
(l_EstateGroups.Count < (int)Constants.EstateAccessLimits.AllowedGroups))
l_EstateGroups.Add(avatarID);
}
@ -333,11 +345,17 @@ namespace OpenSim.Framework
l_EstateGroups.Remove(avatarID);
}
public int EstateManagersCount()
{
return l_EstateManagers.Count;
}
public void AddEstateManager(UUID avatarID)
{
if (avatarID == UUID.Zero)
return;
if (!l_EstateManagers.Contains(avatarID))
if (!l_EstateManagers.Contains(avatarID) &&
(l_EstateManagers.Count < (int)Constants.EstateAccessLimits.EstateManagers))
l_EstateManagers.Add(avatarID);
}
@ -403,11 +421,17 @@ namespace OpenSim.Framework
return false;
}
public int EstateBansCount()
{
return l_EstateBans.Count;
}
public void AddBan(EstateBan ban)
{
if (ban == null)
return;
if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
if (!IsBanned(ban.BannedUserID, 32) &&
(l_EstateBans.Count < (int)Constants.EstateAccessLimits.EstateBans)) //Ignore age-based bans
l_EstateBans.Add(ban);
}

View File

@ -5072,52 +5072,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId;
packet.AgentData.SessionID = SessionId;
packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Utils.StringToBytes("setaccess");
int TotalnumberIDs = Data.Length;
int numberIDs;
int IDIndex = 0;
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length];
for (int i = 0; i < (6 + Data.Length); i++)
do
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
int j = 0;
if(TotalnumberIDs > 63)
numberIDs = 63;
else
numberIDs = TotalnumberIDs;
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
TotalnumberIDs -= numberIDs;
j = 2; // Agents
if ((code & 2) != 0)
j = 3; // Groups
if ((code & 8) != 0)
j = 5; // Managers
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId;
packet.AgentData.SessionID = SessionId;
packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Utils.StringToBytes("setaccess");
returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString());
j = 6;
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + numberIDs];
for (int i = 0; i < Data.Length; i++)
{
returnblock[j].Parameter = Data[i].GetBytes(); j++;
}
packet.ParamList = returnblock;
packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task);
for (int i = 0; i < (6 + numberIDs); i++)
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
returnblock[0].Parameter = Utils.StringToBytes(estateID.ToString());
returnblock[1].Parameter = Utils.StringToBytes(code.ToString());
if((code & 1) != 0) // allowagents
returnblock[2].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[2].Parameter = Utils.StringToBytes("0");
if((code & 2) != 0) // groups
returnblock[3].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[3].Parameter = Utils.StringToBytes("0");
if((code & 4) != 0) // bans
returnblock[4].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[4].Parameter = Utils.StringToBytes("0");
if((code & 8) != 0) // managers
returnblock[5].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[5].Parameter = Utils.StringToBytes("0");
int j = 6;
for (int i = 0; i < numberIDs; i++)
{
returnblock[j].Parameter = Data[IDIndex].GetBytes();
j++;
IDIndex++;
}
packet.ParamList = returnblock;
packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task);
} while (TotalnumberIDs > 0);
}
public void SendBannedUserList(UUID invoice, EstateBan[] bl, uint estateID)
{
List<UUID> BannedUsers = new List<UUID>();
for (int i = 0; i < bl.Length; i++)
{
if (bl[i] == null)
@ -5125,44 +5147,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (bl[i].BannedUserID == UUID.Zero)
continue;
BannedUsers.Add(bl[i].BannedUserID);
if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
{
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId;
packet.AgentData.SessionID = SessionId;
packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Utils.StringToBytes("setaccess");
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
int j;
for (j = 0; j < (6 + BannedUsers.Count); j++)
{
returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
}
j = 0;
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
foreach (UUID banned in BannedUsers)
{
returnblock[j].Parameter = banned.GetBytes(); j++;
}
packet.ParamList = returnblock;
packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task);
BannedUsers.Clear();
}
}
SendEstateList(invoice, 4, BannedUsers.ToArray(), estateID);
}
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
@ -10240,6 +10226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
{
int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
}

View File

@ -33,15 +33,19 @@ using System.Linq;
using System.Reflection;
using System.Security;
using System.Timers;
using System.Threading;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using RegionFlags = OpenMetaverse.RegionFlags;
using Timer = System.Timers.Timer;
namespace OpenSim.Region.CoreModules.World.Estate
{
@ -441,7 +445,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendEstateList(invoice,
(int)Constants.EstateAccessCodex.AccessOptions,
(int)Constants.EstateAccessCodex.AllowedAccess,
Scene.RegionInfo.EstateSettings.EstateAccess,
Scene.RegionInfo.EstateSettings.EstateID);
@ -651,227 +655,354 @@ namespace OpenSim.Region.CoreModules.World.Estate
TriggerRegionInfoChange();
}
private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user)
private object deltareqLock = new object();
private bool runnigDeltaExec = false;
private class EstateAccessDeltaRequest
{
public IClientAPI remote_client;
public UUID invoice;
public int estateAccessType;
public UUID user;
}
private OpenSim.Framework.BlockingQueue<EstateAccessDeltaRequest> deltaRequests = new OpenSim.Framework.BlockingQueue<EstateAccessDeltaRequest>();
private void handleEstateAccessDeltaRequest(IClientAPI _remote_client, UUID _invoice, int _estateAccessType, UUID _user)
{
// EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
if (user == Scene.RegionInfo.EstateSettings.EstateOwner)
if (_user == Scene.RegionInfo.EstateSettings.EstateOwner)
return; // never process EO
if ((estateAccessType & 4) != 0) // User add
EstateAccessDeltaRequest newreq = new EstateAccessDeltaRequest();
newreq.remote_client = _remote_client;
newreq.invoice = _invoice;
newreq.estateAccessType = _estateAccessType;
newreq.user = _user;
deltaRequests.Enqueue(newreq);
lock(deltareqLock)
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if(!runnigDeltaExec)
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.AddEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
}
}
Scene.RegionInfo.EstateSettings.AddEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 8) != 0) // User remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
runnigDeltaExec = true;
WorkManager.RunInThreadPool(execDeltaRequests,null,"execDeltaRequests");
}
}
}
if ((estateAccessType & 16) != 0) // Group add
private void execDeltaRequests(object o)
{
IClientAPI remote_client;
UUID invoice;
int estateAccessType;
UUID user;
Dictionary<int,EstateSettings> changed = new Dictionary<int,EstateSettings>();
Dictionary<IClientAPI,UUID> sendAllowedOrBanList = new Dictionary<IClientAPI,UUID>();
Dictionary<IClientAPI,UUID> sendManagers = new Dictionary<IClientAPI,UUID>();
Dictionary<IClientAPI,UUID> sendGroups = new Dictionary<IClientAPI,UUID>();
List<EstateSettings> otherEstates = new List<EstateSettings>();
bool sentAllowedFull = false;
bool sentBansFull = false;
bool sentGroupsFull = false;
bool sentManagersFull = false;
while(Scene.IsRunning)
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
EstateAccessDeltaRequest req = deltaRequests.Dequeue(500);
if(!Scene.IsRunning)
break;
if(req == null)
{
if ((estateAccessType & 1) != 0) // All estates
if(changed.Count > 0)
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.AddEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
}
}
Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 32) != 0) // Group remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 64) != 0) // Ban add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
{
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (user == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
break;
}
}
if (!alreadyInList)
{
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
EstateBan bitem = new EstateBan();
bitem.BannedUserID = user;
bitem.EstateID = (uint)estateID;
bitem.BannedHostAddress = "0.0.0.0";
bitem.BannedHostIPMask = "0.0.0.0";
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.AddBan(bitem);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
}
}
EstateBan item = new EstateBan();
item.BannedUserID = user;
item.EstateID = Scene.RegionInfo.EstateSettings.EstateID;
item.BannedHostAddress = "0.0.0.0";
item.BannedHostIPMask = "0.0.0.0";
Scene.RegionInfo.EstateSettings.AddBan(item);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
foreach(EstateSettings est in changed.Values)
Scene.EstateDataService.StoreEstateSettings(est);
TriggerEstateInfoChange();
}
ScenePresence s = Scene.GetScenePresence(user);
if (s != null)
EstateSettings es = Scene.RegionInfo.EstateSettings;
foreach(KeyValuePair<IClientAPI,UUID> kvp in sendAllowedOrBanList)
{
IClientAPI cli = kvp.Key;
UUID invoive = kvp.Value;
cli.SendEstateList(invoive, (int)Constants.EstateAccessCodex.AllowedAccess, es.EstateAccess, es.EstateID);
cli.SendBannedUserList(invoive, es.EstateBans, es.EstateID);
}
sendAllowedOrBanList.Clear();
foreach(KeyValuePair<IClientAPI,UUID> kvp in sendManagers)
{
IClientAPI cli = kvp.Key;
cli.SendEstateList(kvp.Value, (int)Constants.EstateAccessCodex.EstateManagers, es.EstateManagers, es.EstateID);
}
foreach(KeyValuePair<IClientAPI,UUID> kvp in sendGroups)
{
IClientAPI cli = kvp.Key;
cli.SendEstateList(kvp.Value, (int)Constants.EstateAccessCodex.AllowedGroups, es.EstateGroups, es.EstateID);
}
otherEstates.Clear();
sendAllowedOrBanList.Clear();
sendManagers.Clear();
sendGroups.Clear();
changed.Clear();
lock(deltareqLock)
{
if(deltaRequests.Count() != 0)
continue;
runnigDeltaExec = false;
return;
}
}
remote_client = req.remote_client;
if(!remote_client.IsActive)
continue;
invoice = req.invoice;
user = req.user;
estateAccessType = req.estateAccessType;
bool needReply = ((estateAccessType & 1024) == 0);
bool doOtherEstates = ((estateAccessType & 3) != 0);
EstateSettings thisSettings = Scene.RegionInfo.EstateSettings;
int thisEstateID =(int)thisSettings.EstateID;
UUID agentID = remote_client.AgentId;
bool isadmin = Scene.Permissions.IsAdministrator(agentID);
// just i case recheck rights
if (!isadmin && !Scene.Permissions.IsEstateManager(agentID))
{
remote_client.SendAlertMessage("Method EstateAccess Failed, you don't have permissions");
continue;
}
otherEstates.Clear();
if(doOtherEstates)
{
UUID thisOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(thisOwner);
foreach (int estateID in estateIDs)
{
if (estateID == thisEstateID)
continue;
EstateSettings estateSettings;
if(changed.ContainsKey(estateID))
estateSettings = changed[estateID];
else
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
otherEstates.Add(estateSettings);
}
estateIDs.Clear();
}
// the commands
// first the ones allowed for estate managers on this region
if ((estateAccessType & 4) != 0) // User add
{
if(thisSettings.EstateUsersCount() >= (int)Constants.EstateAccessLimits.AllowedAccess)
{
if(!sentAllowedFull)
{
if (!s.IsChildAgent)
{
if (!Scene.TeleportClientHome(user, s.ControllingClient))
{
s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
Scene.CloseAgent(s.UUID, false);
}
}
}
sentAllowedFull = true;
remote_client.SendAlertMessage("Estate Allowed users list is full");
}
}
else
{
remote_client.SendAlertMessage("User is already on the region ban list");
}
//Scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if (doOtherEstates)
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
if(estateSettings.EstateUsersCount() >= (int)Constants.EstateAccessLimits.AllowedAccess)
continue;
estateSettings.AddEstateUser(user);
estateSettings.RemoveBan(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
if ((estateAccessType & 128) != 0) // Ban remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
thisSettings.AddEstateUser(user);
thisSettings.RemoveBan(user);
changed[thisEstateID] = thisSettings;;
if(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
}
if ((estateAccessType & 8) != 0) // User remove
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveEstateUser(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
thisSettings.RemoveEstateUser(user);
changed[thisEstateID] = thisSettings;;
if(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
if ((estateAccessType & 16) != 0) // Group add
{
if(thisSettings.EstateGroupsCount() >= (int)Constants.EstateAccessLimits.AllowedGroups)
{
if(!sentGroupsFull)
{
sentGroupsFull = true;
remote_client.SendAlertMessage("Estate Allowed groups list is full");
}
}
else
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
if(estateSettings.EstateGroupsCount() >= (int)Constants.EstateAccessLimits.AllowedGroups)
continue;
estateSettings.AddEstateGroup(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
thisSettings.AddEstateGroup(user);
changed[thisEstateID] = thisSettings;
sendGroups[remote_client] = invoice;
}
}
if ((estateAccessType & 32) != 0) // Group remove
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveEstateGroup(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
thisSettings.RemoveEstateGroup(user);
changed[thisEstateID] = thisSettings;
sendGroups[remote_client] = invoice;
}
if ((estateAccessType & 64) != 0) // Ban add
{
if(thisSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans)
{
if(!sentBansFull)
{
sentBansFull = true;
remote_client.SendAlertMessage("Estate Ban list is full");
}
}
else
{
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false;
for (int i = 0; i < banlistcheck.Length; i++)
{
if (user == banlistcheck[i].BannedUserID)
{
alreadyInList = true;
break;
}
}
if (!alreadyInList)
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
if(estateSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans)
continue;
EstateBan bitem = new EstateBan();
bitem.BannedUserID = user;
bitem.EstateID = estateSettings.EstateID;
bitem.BannedHostAddress = "0.0.0.0";
bitem.BannedHostIPMask = "0.0.0.0";
estateSettings.AddBan(bitem);
estateSettings.RemoveEstateUser(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
EstateBan item = new EstateBan();
item.BannedUserID = user;
item.EstateID = Scene.RegionInfo.EstateSettings.EstateID;
item.BannedHostAddress = "0.0.0.0";
item.BannedHostIPMask = "0.0.0.0";
thisSettings.AddBan(item);
thisSettings.RemoveEstateUser(user);
changed[thisEstateID] = thisSettings;
ScenePresence s = Scene.GetScenePresence(user);
if (s != null)
{
if (!s.IsChildAgent)
{
if (!Scene.TeleportClientHome(user, s.ControllingClient))
{
s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
Scene.CloseAgent(s.UUID, false);
}
}
}
}
else
{
remote_client.SendAlertMessage("User is already on the region ban list");
}
//Scene.RegionInfo.regionBanlist.Add(Manager(user);
if(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
}
if ((estateAccessType & 128) != 0) // Ban remove
{
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
@ -890,104 +1021,90 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (alreadyInList && listitem != null)
{
if ((estateAccessType & 1) != 0) // All estates
if (doOtherEstates) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
foreach (EstateSettings estateSettings in otherEstates)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveBan(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveBan(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
thisSettings.RemoveBan(listitem.BannedUserID);
changed[thisEstateID] = thisSettings;
}
else
{
remote_client.SendAlertMessage("User is not on the region ban list");
}
//Scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
if(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 256) != 0) // Manager add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
// last the ones only for owners of this region
if (!Scene.Permissions.CanIssueEstateCommand(agentID, true))
{
if ((estateAccessType & 1) != 0) // All estates
remote_client.SendAlertMessage("Method EstateAccess Failed, you don't have permissions");
continue;
}
if ((estateAccessType & 256) != 0) // Manager add
{
if(thisSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers)
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
if(!sentManagersFull)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
sentManagersFull = true;
remote_client.SendAlertMessage("Estate Managers list is full");
}
}
else
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
if(!isadmin && !estateSettings.IsEstateOwner(agentID)) // redundante check?
continue;
if(estateSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers)
continue;
estateSettings.AddEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
thisSettings.AddEstateManager(user);
changed[thisEstateID] = thisSettings;
sendManagers[remote_client] = invoice;
}
Scene.RegionInfo.EstateSettings.AddEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 512) != 0) // Manager remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if ((estateAccessType & 512) != 0) // Manager remove
{
if ((estateAccessType & 1) != 0) // All estates
if (doOtherEstates) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
foreach (int estateID in estateIDs)
foreach (EstateSettings estateSettings in otherEstates)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
if(!isadmin && !estateSettings.IsEstateOwner(agentID))
continue;
estateSettings.RemoveEstateManager(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
thisSettings.RemoveEstateManager(user);
changed[thisEstateID] = thisSettings;
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
sendManagers[remote_client] = invoice;
}
}
lock(deltareqLock)
runnigDeltaExec = false;
}
public void HandleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)