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,8 +5072,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{
int TotalnumberIDs = Data.Length;
int numberIDs;
int IDIndex = 0;
do
{
if(TotalnumberIDs > 63)
numberIDs = 63;
else
numberIDs = TotalnumberIDs;
TotalnumberIDs -= numberIDs;
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId;
@ -5081,43 +5093,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Utils.StringToBytes("setaccess");
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length];
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + numberIDs];
for (int i = 0; i < (6 + Data.Length); i++)
for (int i = 0; i < (6 + numberIDs); i++)
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
int j = 0;
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++;
returnblock[0].Parameter = Utils.StringToBytes(estateID.ToString());
returnblock[1].Parameter = Utils.StringToBytes(code.ToString());
j = 2; // Agents
if ((code & 2) != 0)
j = 3; // Groups
if ((code & 8) != 0)
j = 5; // Managers
if((code & 1) != 0) // allowagents
returnblock[2].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[2].Parameter = Utils.StringToBytes("0");
returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString());
j = 6;
if((code & 2) != 0) // groups
returnblock[3].Parameter = Utils.StringToBytes(numberIDs.ToString());
else
returnblock[3].Parameter = Utils.StringToBytes("0");
for (int i = 0; i < Data.Length; i++)
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[i].GetBytes(); j++;
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,145 +655,281 @@ 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
{
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;
EstateAccessDeltaRequest newreq = new EstateAccessDeltaRequest();
newreq.remote_client = _remote_client;
newreq.invoice = _invoice;
newreq.estateAccessType = _estateAccessType;
newreq.user = _user;
foreach (int estateID in estateIDs)
deltaRequests.Enqueue(newreq);
lock(deltareqLock)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
if(!runnigDeltaExec)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.AddEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
runnigDeltaExec = true;
WorkManager.RunInThreadPool(execDeltaRequests,null,"execDeltaRequests");
}
}
}
Scene.RegionInfo.EstateSettings.AddEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
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)
{
EstateAccessDeltaRequest req = deltaRequests.Dequeue(500);
if(!Scene.IsRunning)
break;
if(req == null)
{
if(changed.Count > 0)
{
foreach(EstateSettings est in changed.Values)
Scene.EstateDataService.StoreEstateSettings(est);
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
}
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)
{
sentAllowedFull = true;
remote_client.SendAlertMessage("Estate Allowed users list is full");
}
}
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;
}
}
thisSettings.AddEstateUser(user);
thisSettings.RemoveBan(user);
changed[thisEstateID] = thisSettings;;
if(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
}
if ((estateAccessType & 8) != 0) // User remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if (doOtherEstates) // All estates
{
if ((estateAccessType & 1) != 0) // All estates
foreach (EstateSettings estateSettings in otherEstates)
{
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);
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
thisSettings.RemoveEstateUser(user);
changed[thisEstateID] = thisSettings;;
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(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
if ((estateAccessType & 16) != 0) // Group add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if(thisSettings.EstateGroupsCount() >= (int)Constants.EstateAccessLimits.AllowedGroups)
{
if ((estateAccessType & 1) != 0) // All estates
if(!sentGroupsFull)
{
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);
sentGroupsFull = true;
remote_client.SendAlertMessage("Estate Allowed groups list is full");
}
}
}
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 (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 (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if (doOtherEstates) // All estates
{
if ((estateAccessType & 1) != 0) // All estates
foreach (EstateSettings estateSettings in otherEstates)
{
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);
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
thisSettings.RemoveEstateGroup(user);
changed[thisEstateID] = thisSettings;
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");
}
sendGroups[remote_client] = invoice;
}
if ((estateAccessType & 64) != 0) // Ban add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
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;
@ -802,31 +942,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
alreadyInList = true;
break;
}
}
if (!alreadyInList)
{
if (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
if ((estateAccessType & 1) != 0) // All estates
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
if(estateSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans)
continue;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
EstateBan bitem = new EstateBan();
bitem.BannedUserID = user;
bitem.EstateID = (uint)estateID;
bitem.EstateID = estateSettings.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);
}
estateSettings.RemoveEstateUser(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
@ -837,10 +975,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
item.BannedHostAddress = "0.0.0.0";
item.BannedHostIPMask = "0.0.0.0";
Scene.RegionInfo.EstateSettings.AddBan(item);
Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
TriggerEstateInfoChange();
thisSettings.AddBan(item);
thisSettings.RemoveEstateUser(user);
changed[thisEstateID] = thisSettings;
ScenePresence s = Scene.GetScenePresence(user);
if (s != null)
@ -854,24 +991,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
}
}
}
}
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(needReply)
sendAllowedOrBanList[remote_client] = invoice;
}
}
if ((estateAccessType & 128) != 0) // Ban remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
{
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);
if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID))
continue;
estateSettings.RemoveBan(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
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
// last the ones only for owners of this region
if (!Scene.Permissions.CanIssueEstateCommand(agentID, true))
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
remote_client.SendAlertMessage("Method EstateAccess Failed, you don't have permissions");
continue;
}
if ((estateAccessType & 256) != 0) // Manager add
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if(thisSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers)
{
if ((estateAccessType & 1) != 0) // All estates
if(!sentManagersFull)
{
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.AddEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
sentManagersFull = true;
remote_client.SendAlertMessage("Estate Managers list is full");
}
}
}
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 (doOtherEstates) // All estates
{
foreach (EstateSettings estateSettings in otherEstates)
{
if(!isadmin && !estateSettings.IsEstateOwner(agentID)) // redundante check?
continue;
if(estateSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers)
continue;
estateSettings.AddEstateManager(user);
changed[(int)estateSettings.EstateID] = estateSettings;
}
}
thisSettings.AddEstateManager(user);
changed[thisEstateID] = thisSettings;
sendManagers[remote_client] = invoice;
}
}
if ((estateAccessType & 512) != 0) // Manager remove
{
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
if (doOtherEstates) // All estates
{
if ((estateAccessType & 1) != 0) // All estates
foreach (EstateSettings estateSettings in otherEstates)
{
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
EstateSettings estateSettings;
if(!isadmin && !estateSettings.IsEstateOwner(agentID))
continue;
foreach (int estateID in estateIDs)
{
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
{
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
estateSettings.RemoveEstateManager(user);
Scene.EstateDataService.StoreEstateSettings(estateSettings);
}
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)