diff options
author | UbitUmarov | 2016-10-24 10:23:31 +0100 |
---|---|---|
committer | UbitUmarov | 2016-10-24 10:23:31 +0100 |
commit | d550b485f1409030149447c71b3de881232d4897 (patch) | |
tree | 2bd710e1e5dd0957f05860aa93cf1a52485c6334 | |
parent | ignore prims with shape type none on max size check for physics (diff) | |
download | opensim-SC_OLD-d550b485f1409030149447c71b3de881232d4897.zip opensim-SC_OLD-d550b485f1409030149447c71b3de881232d4897.tar.gz opensim-SC_OLD-d550b485f1409030149447c71b3de881232d4897.tar.bz2 opensim-SC_OLD-d550b485f1409030149447c71b3de881232d4897.tar.xz |
viewer crash bug fix: fis the udp packets split of SendEstateList() large lists; Enforce size limits on the estate lists since currently required for viewers compatibily; improve handling of changes with large selected items. This is still bad, users may need to close and reopen the region/estate information to get correct Allowed and Banned lists after a change. This happens because of viewer resent/outOfOrder packets that completly break this lists updates protocol
-rw-r--r-- | OpenSim/Framework/Constants.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 129 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 527 |
4 files changed, 417 insertions, 281 deletions
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 3ba264c..209c991 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs | |||
@@ -46,12 +46,20 @@ namespace OpenSim.Framework | |||
46 | 46 | ||
47 | public enum EstateAccessCodex : uint | 47 | public enum EstateAccessCodex : uint |
48 | { | 48 | { |
49 | AccessOptions = 1, | 49 | AllowedAccess = 1, |
50 | AllowedGroups = 2, | 50 | AllowedGroups = 2, |
51 | EstateBans = 4, | 51 | EstateBans = 4, |
52 | EstateManagers = 8 | 52 | EstateManagers = 8 |
53 | } | 53 | } |
54 | 54 | ||
55 | public enum EstateAccessLimits : int | ||
56 | { | ||
57 | AllowedAccess = 500, | ||
58 | AllowedGroups = 63, | ||
59 | EstateBans = 500, | ||
60 | EstateManagers = 10 | ||
61 | } | ||
62 | |||
55 | [Flags]public enum TeleportFlags : uint | 63 | [Flags]public enum TeleportFlags : uint |
56 | { | 64 | { |
57 | /// <summary>No flags set, or teleport failed</summary> | 65 | /// <summary>No flags set, or teleport failed</summary> |
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 4c9f6e9..844230b 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -305,11 +305,17 @@ namespace OpenSim.Framework | |||
305 | OnSave(this); | 305 | OnSave(this); |
306 | } | 306 | } |
307 | 307 | ||
308 | public int EstateUsersCount() | ||
309 | { | ||
310 | return l_EstateAccess.Count; | ||
311 | } | ||
312 | |||
308 | public void AddEstateUser(UUID avatarID) | 313 | public void AddEstateUser(UUID avatarID) |
309 | { | 314 | { |
310 | if (avatarID == UUID.Zero) | 315 | if (avatarID == UUID.Zero) |
311 | return; | 316 | return; |
312 | if (!l_EstateAccess.Contains(avatarID)) | 317 | if (!l_EstateAccess.Contains(avatarID) && |
318 | (l_EstateAccess.Count < (int)Constants.EstateAccessLimits.AllowedAccess)) | ||
313 | l_EstateAccess.Add(avatarID); | 319 | l_EstateAccess.Add(avatarID); |
314 | } | 320 | } |
315 | 321 | ||
@@ -319,11 +325,17 @@ namespace OpenSim.Framework | |||
319 | l_EstateAccess.Remove(avatarID); | 325 | l_EstateAccess.Remove(avatarID); |
320 | } | 326 | } |
321 | 327 | ||
328 | public int EstateGroupsCount() | ||
329 | { | ||
330 | return l_EstateGroups.Count; | ||
331 | } | ||
332 | |||
322 | public void AddEstateGroup(UUID avatarID) | 333 | public void AddEstateGroup(UUID avatarID) |
323 | { | 334 | { |
324 | if (avatarID == UUID.Zero) | 335 | if (avatarID == UUID.Zero) |
325 | return; | 336 | return; |
326 | if (!l_EstateGroups.Contains(avatarID)) | 337 | if (!l_EstateGroups.Contains(avatarID) && |
338 | (l_EstateGroups.Count < (int)Constants.EstateAccessLimits.AllowedGroups)) | ||
327 | l_EstateGroups.Add(avatarID); | 339 | l_EstateGroups.Add(avatarID); |
328 | } | 340 | } |
329 | 341 | ||
@@ -333,11 +345,17 @@ namespace OpenSim.Framework | |||
333 | l_EstateGroups.Remove(avatarID); | 345 | l_EstateGroups.Remove(avatarID); |
334 | } | 346 | } |
335 | 347 | ||
348 | public int EstateManagersCount() | ||
349 | { | ||
350 | return l_EstateManagers.Count; | ||
351 | } | ||
352 | |||
336 | public void AddEstateManager(UUID avatarID) | 353 | public void AddEstateManager(UUID avatarID) |
337 | { | 354 | { |
338 | if (avatarID == UUID.Zero) | 355 | if (avatarID == UUID.Zero) |
339 | return; | 356 | return; |
340 | if (!l_EstateManagers.Contains(avatarID)) | 357 | if (!l_EstateManagers.Contains(avatarID) && |
358 | (l_EstateManagers.Count < (int)Constants.EstateAccessLimits.EstateManagers)) | ||
341 | l_EstateManagers.Add(avatarID); | 359 | l_EstateManagers.Add(avatarID); |
342 | } | 360 | } |
343 | 361 | ||
@@ -403,11 +421,17 @@ namespace OpenSim.Framework | |||
403 | return false; | 421 | return false; |
404 | } | 422 | } |
405 | 423 | ||
424 | public int EstateBansCount() | ||
425 | { | ||
426 | return l_EstateBans.Count; | ||
427 | } | ||
428 | |||
406 | public void AddBan(EstateBan ban) | 429 | public void AddBan(EstateBan ban) |
407 | { | 430 | { |
408 | if (ban == null) | 431 | if (ban == null) |
409 | return; | 432 | return; |
410 | if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans | 433 | if (!IsBanned(ban.BannedUserID, 32) && |
434 | (l_EstateBans.Count < (int)Constants.EstateAccessLimits.EstateBans)) //Ignore age-based bans | ||
411 | l_EstateBans.Add(ban); | 435 | l_EstateBans.Add(ban); |
412 | } | 436 | } |
413 | 437 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fd3f997..ad25bc8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5072,52 +5072,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5072 | } | 5072 | } |
5073 | 5073 | ||
5074 | public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) | 5074 | public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) |
5075 | |||
5076 | { | 5075 | { |
5077 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); | 5076 | int TotalnumberIDs = Data.Length; |
5078 | packet.AgentData.TransactionID = UUID.Random(); | 5077 | int numberIDs; |
5079 | packet.AgentData.AgentID = AgentId; | 5078 | int IDIndex = 0; |
5080 | packet.AgentData.SessionID = SessionId; | ||
5081 | packet.MethodData.Invoice = invoice; | ||
5082 | packet.MethodData.Method = Utils.StringToBytes("setaccess"); | ||
5083 | 5079 | ||
5084 | EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length]; | 5080 | do |
5085 | |||
5086 | for (int i = 0; i < (6 + Data.Length); i++) | ||
5087 | { | 5081 | { |
5088 | returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); | 5082 | if(TotalnumberIDs > 63) |
5089 | } | 5083 | numberIDs = 63; |
5090 | int j = 0; | 5084 | else |
5085 | numberIDs = TotalnumberIDs; | ||
5091 | 5086 | ||
5092 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; | 5087 | TotalnumberIDs -= numberIDs; |
5093 | returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++; | ||
5094 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5095 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5096 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5097 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5098 | 5088 | ||
5099 | j = 2; // Agents | 5089 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); |
5100 | if ((code & 2) != 0) | 5090 | packet.AgentData.TransactionID = UUID.Random(); |
5101 | j = 3; // Groups | 5091 | packet.AgentData.AgentID = AgentId; |
5102 | if ((code & 8) != 0) | 5092 | packet.AgentData.SessionID = SessionId; |
5103 | j = 5; // Managers | 5093 | packet.MethodData.Invoice = invoice; |
5094 | packet.MethodData.Method = Utils.StringToBytes("setaccess"); | ||
5104 | 5095 | ||
5105 | returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); | 5096 | EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + numberIDs]; |
5106 | j = 6; | ||
5107 | 5097 | ||
5108 | for (int i = 0; i < Data.Length; i++) | 5098 | for (int i = 0; i < (6 + numberIDs); i++) |
5109 | { | 5099 | { |
5110 | returnblock[j].Parameter = Data[i].GetBytes(); j++; | 5100 | returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); |
5111 | } | 5101 | } |
5112 | packet.ParamList = returnblock; | 5102 | |
5113 | packet.Header.Reliable = true; | 5103 | returnblock[0].Parameter = Utils.StringToBytes(estateID.ToString()); |
5114 | OutPacket(packet, ThrottleOutPacketType.Task); | 5104 | returnblock[1].Parameter = Utils.StringToBytes(code.ToString()); |
5105 | |||
5106 | if((code & 1) != 0) // allowagents | ||
5107 | returnblock[2].Parameter = Utils.StringToBytes(numberIDs.ToString()); | ||
5108 | else | ||
5109 | returnblock[2].Parameter = Utils.StringToBytes("0"); | ||
5110 | |||
5111 | if((code & 2) != 0) // groups | ||
5112 | returnblock[3].Parameter = Utils.StringToBytes(numberIDs.ToString()); | ||
5113 | else | ||
5114 | returnblock[3].Parameter = Utils.StringToBytes("0"); | ||
5115 | |||
5116 | if((code & 4) != 0) // bans | ||
5117 | returnblock[4].Parameter = Utils.StringToBytes(numberIDs.ToString()); | ||
5118 | else | ||
5119 | returnblock[4].Parameter = Utils.StringToBytes("0"); | ||
5120 | |||
5121 | if((code & 8) != 0) // managers | ||
5122 | returnblock[5].Parameter = Utils.StringToBytes(numberIDs.ToString()); | ||
5123 | else | ||
5124 | returnblock[5].Parameter = Utils.StringToBytes("0"); | ||
5125 | |||
5126 | int j = 6; | ||
5127 | |||
5128 | for (int i = 0; i < numberIDs; i++) | ||
5129 | { | ||
5130 | returnblock[j].Parameter = Data[IDIndex].GetBytes(); | ||
5131 | j++; | ||
5132 | IDIndex++; | ||
5133 | } | ||
5134 | packet.ParamList = returnblock; | ||
5135 | packet.Header.Reliable = true; | ||
5136 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
5137 | } while (TotalnumberIDs > 0); | ||
5115 | } | 5138 | } |
5116 | 5139 | ||
5117 | public void SendBannedUserList(UUID invoice, EstateBan[] bl, uint estateID) | 5140 | public void SendBannedUserList(UUID invoice, EstateBan[] bl, uint estateID) |
5118 | { | 5141 | { |
5119 | List<UUID> BannedUsers = new List<UUID>(); | 5142 | List<UUID> BannedUsers = new List<UUID>(); |
5120 | |||
5121 | for (int i = 0; i < bl.Length; i++) | 5143 | for (int i = 0; i < bl.Length; i++) |
5122 | { | 5144 | { |
5123 | if (bl[i] == null) | 5145 | if (bl[i] == null) |
@@ -5125,44 +5147,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5125 | if (bl[i].BannedUserID == UUID.Zero) | 5147 | if (bl[i].BannedUserID == UUID.Zero) |
5126 | continue; | 5148 | continue; |
5127 | BannedUsers.Add(bl[i].BannedUserID); | 5149 | BannedUsers.Add(bl[i].BannedUserID); |
5128 | |||
5129 | if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0)) | ||
5130 | { | ||
5131 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); | ||
5132 | packet.AgentData.TransactionID = UUID.Random(); | ||
5133 | packet.AgentData.AgentID = AgentId; | ||
5134 | packet.AgentData.SessionID = SessionId; | ||
5135 | packet.MethodData.Invoice = invoice; | ||
5136 | packet.MethodData.Method = Utils.StringToBytes("setaccess"); | ||
5137 | |||
5138 | EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; | ||
5139 | |||
5140 | int j; | ||
5141 | for (j = 0; j < (6 + BannedUsers.Count); j++) | ||
5142 | { | ||
5143 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); | ||
5144 | } | ||
5145 | j = 0; | ||
5146 | |||
5147 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; | ||
5148 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; | ||
5149 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5150 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5151 | returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; | ||
5152 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | ||
5153 | |||
5154 | foreach (UUID banned in BannedUsers) | ||
5155 | { | ||
5156 | returnblock[j].Parameter = banned.GetBytes(); j++; | ||
5157 | } | ||
5158 | packet.ParamList = returnblock; | ||
5159 | packet.Header.Reliable = true; | ||
5160 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
5161 | |||
5162 | BannedUsers.Clear(); | ||
5163 | } | ||
5164 | } | 5150 | } |
5165 | 5151 | SendEstateList(invoice, 4, BannedUsers.ToArray(), estateID); | |
5166 | } | 5152 | } |
5167 | 5153 | ||
5168 | public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) | 5154 | public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) |
@@ -10240,6 +10226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10240 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | 10226 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) |
10241 | { | 10227 | { |
10242 | int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | 10228 | int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); |
10229 | |||
10243 | OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter))); | 10230 | OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter))); |
10244 | 10231 | ||
10245 | } | 10232 | } |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 87fb0db..8eb2b1e 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -33,15 +33,19 @@ using System.Linq; | |||
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Security; | 34 | using System.Security; |
35 | using System.Timers; | 35 | using System.Timers; |
36 | using System.Threading; | ||
36 | using log4net; | 37 | using log4net; |
37 | using Mono.Addins; | 38 | using Mono.Addins; |
38 | using Nini.Config; | 39 | using Nini.Config; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Monitoring; | ||
41 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
44 | using RegionFlags = OpenMetaverse.RegionFlags; | 46 | using RegionFlags = OpenMetaverse.RegionFlags; |
47 | using Timer = System.Timers.Timer; | ||
48 | |||
45 | 49 | ||
46 | namespace OpenSim.Region.CoreModules.World.Estate | 50 | namespace OpenSim.Region.CoreModules.World.Estate |
47 | { | 51 | { |
@@ -441,7 +445,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
441 | Scene.RegionInfo.EstateSettings.EstateID); | 445 | Scene.RegionInfo.EstateSettings.EstateID); |
442 | 446 | ||
443 | remote_client.SendEstateList(invoice, | 447 | remote_client.SendEstateList(invoice, |
444 | (int)Constants.EstateAccessCodex.AccessOptions, | 448 | (int)Constants.EstateAccessCodex.AllowedAccess, |
445 | Scene.RegionInfo.EstateSettings.EstateAccess, | 449 | Scene.RegionInfo.EstateSettings.EstateAccess, |
446 | Scene.RegionInfo.EstateSettings.EstateID); | 450 | Scene.RegionInfo.EstateSettings.EstateID); |
447 | 451 | ||
@@ -651,227 +655,354 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
651 | TriggerRegionInfoChange(); | 655 | TriggerRegionInfoChange(); |
652 | } | 656 | } |
653 | 657 | ||
654 | private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user) | 658 | private object deltareqLock = new object(); |
659 | private bool runnigDeltaExec = false; | ||
660 | |||
661 | private class EstateAccessDeltaRequest | ||
662 | { | ||
663 | public IClientAPI remote_client; | ||
664 | public UUID invoice; | ||
665 | public int estateAccessType; | ||
666 | public UUID user; | ||
667 | } | ||
668 | |||
669 | private OpenSim.Framework.BlockingQueue<EstateAccessDeltaRequest> deltaRequests = new OpenSim.Framework.BlockingQueue<EstateAccessDeltaRequest>(); | ||
670 | |||
671 | private void handleEstateAccessDeltaRequest(IClientAPI _remote_client, UUID _invoice, int _estateAccessType, UUID _user) | ||
655 | { | 672 | { |
656 | // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. | 673 | // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. |
657 | 674 | ||
658 | if (user == Scene.RegionInfo.EstateSettings.EstateOwner) | 675 | if (_user == Scene.RegionInfo.EstateSettings.EstateOwner) |
659 | return; // never process EO | 676 | return; // never process EO |
660 | 677 | ||
661 | if ((estateAccessType & 4) != 0) // User add | 678 | EstateAccessDeltaRequest newreq = new EstateAccessDeltaRequest(); |
679 | newreq.remote_client = _remote_client; | ||
680 | newreq.invoice = _invoice; | ||
681 | newreq.estateAccessType = _estateAccessType; | ||
682 | newreq.user = _user; | ||
683 | |||
684 | deltaRequests.Enqueue(newreq); | ||
685 | |||
686 | lock(deltareqLock) | ||
687 | { | ||
688 | if(!runnigDeltaExec) | ||
689 | { | ||
690 | runnigDeltaExec = true; | ||
691 | WorkManager.RunInThreadPool(execDeltaRequests,null,"execDeltaRequests"); | ||
692 | } | ||
693 | } | ||
694 | } | ||
695 | |||
696 | private void execDeltaRequests(object o) | ||
697 | { | ||
698 | IClientAPI remote_client; | ||
699 | UUID invoice; | ||
700 | int estateAccessType; | ||
701 | UUID user; | ||
702 | Dictionary<int,EstateSettings> changed = new Dictionary<int,EstateSettings>(); | ||
703 | Dictionary<IClientAPI,UUID> sendAllowedOrBanList = new Dictionary<IClientAPI,UUID>(); | ||
704 | Dictionary<IClientAPI,UUID> sendManagers = new Dictionary<IClientAPI,UUID>(); | ||
705 | Dictionary<IClientAPI,UUID> sendGroups = new Dictionary<IClientAPI,UUID>(); | ||
706 | |||
707 | List<EstateSettings> otherEstates = new List<EstateSettings>(); | ||
708 | |||
709 | bool sentAllowedFull = false; | ||
710 | bool sentBansFull = false; | ||
711 | bool sentGroupsFull = false; | ||
712 | bool sentManagersFull = false; | ||
713 | |||
714 | while(Scene.IsRunning) | ||
662 | { | 715 | { |
663 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | 716 | EstateAccessDeltaRequest req = deltaRequests.Dequeue(500); |
717 | |||
718 | if(!Scene.IsRunning) | ||
719 | break; | ||
720 | |||
721 | if(req == null) | ||
664 | { | 722 | { |
665 | if ((estateAccessType & 1) != 0) // All estates | 723 | if(changed.Count > 0) |
666 | { | 724 | { |
667 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 725 | foreach(EstateSettings est in changed.Values) |
668 | EstateSettings estateSettings; | 726 | Scene.EstateDataService.StoreEstateSettings(est); |
727 | |||
728 | TriggerEstateInfoChange(); | ||
729 | } | ||
730 | |||
731 | EstateSettings es = Scene.RegionInfo.EstateSettings; | ||
732 | foreach(KeyValuePair<IClientAPI,UUID> kvp in sendAllowedOrBanList) | ||
733 | { | ||
734 | IClientAPI cli = kvp.Key; | ||
735 | UUID invoive = kvp.Value; | ||
736 | cli.SendEstateList(invoive, (int)Constants.EstateAccessCodex.AllowedAccess, es.EstateAccess, es.EstateID); | ||
737 | cli.SendBannedUserList(invoive, es.EstateBans, es.EstateID); | ||
738 | } | ||
739 | sendAllowedOrBanList.Clear(); | ||
669 | 740 | ||
670 | foreach (int estateID in estateIDs) | 741 | foreach(KeyValuePair<IClientAPI,UUID> kvp in sendManagers) |
671 | { | 742 | { |
672 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 743 | IClientAPI cli = kvp.Key; |
673 | { | 744 | cli.SendEstateList(kvp.Value, (int)Constants.EstateAccessCodex.EstateManagers, es.EstateManagers, es.EstateID); |
674 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 745 | } |
675 | estateSettings.AddEstateUser(user); | 746 | foreach(KeyValuePair<IClientAPI,UUID> kvp in sendGroups) |
676 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 747 | { |
677 | } | 748 | IClientAPI cli = kvp.Key; |
678 | } | 749 | cli.SendEstateList(kvp.Value, (int)Constants.EstateAccessCodex.AllowedGroups, es.EstateGroups, es.EstateID); |
679 | } | 750 | } |
751 | otherEstates.Clear(); | ||
752 | sendAllowedOrBanList.Clear(); | ||
753 | sendManagers.Clear(); | ||
754 | sendGroups.Clear(); | ||
755 | changed.Clear(); | ||
756 | lock(deltareqLock) | ||
757 | { | ||
758 | if(deltaRequests.Count() != 0) | ||
759 | continue; | ||
760 | runnigDeltaExec = false; | ||
761 | return; | ||
762 | } | ||
763 | } | ||
680 | 764 | ||
681 | Scene.RegionInfo.EstateSettings.AddEstateUser(user); | 765 | remote_client = req.remote_client; |
682 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 766 | if(!remote_client.IsActive) |
767 | continue; | ||
683 | 768 | ||
684 | TriggerEstateInfoChange(); | 769 | invoice = req.invoice; |
685 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 770 | user = req.user; |
686 | } | 771 | |
687 | else | 772 | estateAccessType = req.estateAccessType; |
773 | |||
774 | bool needReply = ((estateAccessType & 1024) == 0); | ||
775 | bool doOtherEstates = ((estateAccessType & 3) != 0); | ||
776 | |||
777 | EstateSettings thisSettings = Scene.RegionInfo.EstateSettings; | ||
778 | int thisEstateID =(int)thisSettings.EstateID; | ||
779 | |||
780 | UUID agentID = remote_client.AgentId; | ||
781 | |||
782 | bool isadmin = Scene.Permissions.IsAdministrator(agentID); | ||
783 | // just i case recheck rights | ||
784 | if (!isadmin && !Scene.Permissions.IsEstateManager(agentID)) | ||
688 | { | 785 | { |
689 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 786 | remote_client.SendAlertMessage("Method EstateAccess Failed, you don't have permissions"); |
787 | continue; | ||
690 | } | 788 | } |
691 | 789 | ||
692 | } | 790 | otherEstates.Clear(); |
693 | 791 | if(doOtherEstates) | |
694 | if ((estateAccessType & 8) != 0) // User remove | ||
695 | { | ||
696 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | ||
697 | { | 792 | { |
698 | if ((estateAccessType & 1) != 0) // All estates | 793 | UUID thisOwner = Scene.RegionInfo.EstateSettings.EstateOwner; |
794 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(thisOwner); | ||
795 | foreach (int estateID in estateIDs) | ||
699 | { | 796 | { |
700 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 797 | if (estateID == thisEstateID) |
798 | continue; | ||
799 | |||
701 | EstateSettings estateSettings; | 800 | EstateSettings estateSettings; |
801 | if(changed.ContainsKey(estateID)) | ||
802 | estateSettings = changed[estateID]; | ||
803 | else | ||
804 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
702 | 805 | ||
703 | foreach (int estateID in estateIDs) | 806 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) |
807 | continue; | ||
808 | otherEstates.Add(estateSettings); | ||
809 | } | ||
810 | estateIDs.Clear(); | ||
811 | } | ||
812 | |||
813 | // the commands | ||
814 | // first the ones allowed for estate managers on this region | ||
815 | if ((estateAccessType & 4) != 0) // User add | ||
816 | { | ||
817 | if(thisSettings.EstateUsersCount() >= (int)Constants.EstateAccessLimits.AllowedAccess) | ||
818 | { | ||
819 | if(!sentAllowedFull) | ||
820 | { | ||
821 | sentAllowedFull = true; | ||
822 | remote_client.SendAlertMessage("Estate Allowed users list is full"); | ||
823 | } | ||
824 | } | ||
825 | else | ||
826 | { | ||
827 | if (doOtherEstates) | ||
704 | { | 828 | { |
705 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 829 | foreach (EstateSettings estateSettings in otherEstates) |
706 | { | 830 | { |
707 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 831 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) |
708 | estateSettings.RemoveEstateUser(user); | 832 | continue; |
709 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 833 | if(estateSettings.EstateUsersCount() >= (int)Constants.EstateAccessLimits.AllowedAccess) |
834 | continue; | ||
835 | estateSettings.AddEstateUser(user); | ||
836 | estateSettings.RemoveBan(user); | ||
837 | changed[(int)estateSettings.EstateID] = estateSettings; | ||
710 | } | 838 | } |
711 | } | 839 | } |
712 | } | ||
713 | 840 | ||
714 | Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); | 841 | thisSettings.AddEstateUser(user); |
715 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 842 | thisSettings.RemoveBan(user); |
843 | changed[thisEstateID] = thisSettings;; | ||
716 | 844 | ||
717 | TriggerEstateInfoChange(); | 845 | if(needReply) |
718 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 846 | sendAllowedOrBanList[remote_client] = invoice; |
847 | } | ||
719 | } | 848 | } |
720 | else | 849 | |
850 | if ((estateAccessType & 8) != 0) // User remove | ||
721 | { | 851 | { |
722 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 852 | if (doOtherEstates) // All estates |
853 | { | ||
854 | foreach (EstateSettings estateSettings in otherEstates) | ||
855 | { | ||
856 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) | ||
857 | continue; | ||
858 | estateSettings.RemoveEstateUser(user); | ||
859 | changed[(int)estateSettings.EstateID] = estateSettings; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | thisSettings.RemoveEstateUser(user); | ||
864 | changed[thisEstateID] = thisSettings;; | ||
865 | |||
866 | if(needReply) | ||
867 | sendAllowedOrBanList[remote_client] = invoice; | ||
723 | } | 868 | } |
724 | } | ||
725 | 869 | ||
726 | if ((estateAccessType & 16) != 0) // Group add | 870 | if ((estateAccessType & 16) != 0) // Group add |
727 | { | ||
728 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | ||
729 | { | 871 | { |
730 | if ((estateAccessType & 1) != 0) // All estates | 872 | if(thisSettings.EstateGroupsCount() >= (int)Constants.EstateAccessLimits.AllowedGroups) |
731 | { | 873 | { |
732 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 874 | if(!sentGroupsFull) |
733 | EstateSettings estateSettings; | ||
734 | |||
735 | foreach (int estateID in estateIDs) | ||
736 | { | 875 | { |
737 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 876 | sentGroupsFull = true; |
877 | remote_client.SendAlertMessage("Estate Allowed groups list is full"); | ||
878 | } | ||
879 | } | ||
880 | else | ||
881 | { | ||
882 | if (doOtherEstates) // All estates | ||
883 | { | ||
884 | foreach (EstateSettings estateSettings in otherEstates) | ||
738 | { | 885 | { |
739 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 886 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) |
887 | continue; | ||
888 | if(estateSettings.EstateGroupsCount() >= (int)Constants.EstateAccessLimits.AllowedGroups) | ||
889 | continue; | ||
740 | estateSettings.AddEstateGroup(user); | 890 | estateSettings.AddEstateGroup(user); |
741 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 891 | changed[(int)estateSettings.EstateID] = estateSettings; |
742 | } | 892 | } |
743 | } | 893 | } |
744 | } | ||
745 | 894 | ||
746 | Scene.RegionInfo.EstateSettings.AddEstateGroup(user); | 895 | thisSettings.AddEstateGroup(user); |
747 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 896 | changed[thisEstateID] = thisSettings; |
748 | 897 | ||
749 | TriggerEstateInfoChange(); | 898 | sendGroups[remote_client] = invoice; |
750 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | 899 | } |
751 | } | ||
752 | else | ||
753 | { | ||
754 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
755 | } | 900 | } |
756 | } | ||
757 | 901 | ||
758 | if ((estateAccessType & 32) != 0) // Group remove | 902 | if ((estateAccessType & 32) != 0) // Group remove |
759 | { | ||
760 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | ||
761 | { | 903 | { |
762 | if ((estateAccessType & 1) != 0) // All estates | 904 | if (doOtherEstates) // All estates |
763 | { | 905 | { |
764 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 906 | foreach (EstateSettings estateSettings in otherEstates) |
765 | EstateSettings estateSettings; | ||
766 | |||
767 | foreach (int estateID in estateIDs) | ||
768 | { | 907 | { |
769 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 908 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) |
770 | { | 909 | continue; |
771 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 910 | estateSettings.RemoveEstateGroup(user); |
772 | estateSettings.RemoveEstateGroup(user); | 911 | changed[(int)estateSettings.EstateID] = estateSettings; |
773 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | ||
774 | } | ||
775 | } | 912 | } |
776 | } | 913 | } |
777 | 914 | ||
778 | Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); | 915 | thisSettings.RemoveEstateGroup(user); |
779 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 916 | changed[thisEstateID] = thisSettings; |
780 | 917 | ||
781 | TriggerEstateInfoChange(); | 918 | sendGroups[remote_client] = invoice; |
782 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | ||
783 | } | ||
784 | else | ||
785 | { | ||
786 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
787 | } | 919 | } |
788 | } | ||
789 | 920 | ||
790 | if ((estateAccessType & 64) != 0) // Ban add | 921 | if ((estateAccessType & 64) != 0) // Ban add |
791 | { | ||
792 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) | ||
793 | { | 922 | { |
794 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; | ||
795 | |||
796 | bool alreadyInList = false; | ||
797 | 923 | ||
798 | for (int i = 0; i < banlistcheck.Length; i++) | 924 | if(thisSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans) |
799 | { | 925 | { |
800 | if (user == banlistcheck[i].BannedUserID) | 926 | if(!sentBansFull) |
801 | { | 927 | { |
802 | alreadyInList = true; | 928 | sentBansFull = true; |
803 | break; | 929 | remote_client.SendAlertMessage("Estate Ban list is full"); |
804 | } | 930 | } |
805 | |||
806 | } | 931 | } |
807 | if (!alreadyInList) | 932 | else |
808 | { | 933 | { |
934 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; | ||
809 | 935 | ||
810 | if ((estateAccessType & 1) != 0) // All estates | 936 | bool alreadyInList = false; |
811 | { | ||
812 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
813 | EstateSettings estateSettings; | ||
814 | 937 | ||
815 | foreach (int estateID in estateIDs) | 938 | for (int i = 0; i < banlistcheck.Length; i++) |
939 | { | ||
940 | if (user == banlistcheck[i].BannedUserID) | ||
941 | { | ||
942 | alreadyInList = true; | ||
943 | break; | ||
944 | } | ||
945 | } | ||
946 | if (!alreadyInList) | ||
947 | { | ||
948 | if (doOtherEstates) // All estates | ||
816 | { | 949 | { |
817 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 950 | foreach (EstateSettings estateSettings in otherEstates) |
818 | { | 951 | { |
952 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) | ||
953 | continue; | ||
954 | |||
955 | if(estateSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans) | ||
956 | continue; | ||
957 | |||
819 | EstateBan bitem = new EstateBan(); | 958 | EstateBan bitem = new EstateBan(); |
820 | 959 | ||
821 | bitem.BannedUserID = user; | 960 | bitem.BannedUserID = user; |
822 | bitem.EstateID = (uint)estateID; | 961 | bitem.EstateID = estateSettings.EstateID; |
823 | bitem.BannedHostAddress = "0.0.0.0"; | 962 | bitem.BannedHostAddress = "0.0.0.0"; |
824 | bitem.BannedHostIPMask = "0.0.0.0"; | 963 | bitem.BannedHostIPMask = "0.0.0.0"; |
825 | 964 | ||
826 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
827 | estateSettings.AddBan(bitem); | 965 | estateSettings.AddBan(bitem); |
828 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 966 | estateSettings.RemoveEstateUser(user); |
967 | changed[(int)estateSettings.EstateID] = estateSettings; | ||
829 | } | 968 | } |
830 | } | 969 | } |
831 | } | ||
832 | |||
833 | EstateBan item = new EstateBan(); | ||
834 | 970 | ||
835 | item.BannedUserID = user; | 971 | EstateBan item = new EstateBan(); |
836 | item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
837 | item.BannedHostAddress = "0.0.0.0"; | ||
838 | item.BannedHostIPMask = "0.0.0.0"; | ||
839 | 972 | ||
840 | Scene.RegionInfo.EstateSettings.AddBan(item); | 973 | item.BannedUserID = user; |
841 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 974 | item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; |
975 | item.BannedHostAddress = "0.0.0.0"; | ||
976 | item.BannedHostIPMask = "0.0.0.0"; | ||
842 | 977 | ||
843 | TriggerEstateInfoChange(); | 978 | thisSettings.AddBan(item); |
979 | thisSettings.RemoveEstateUser(user); | ||
980 | changed[thisEstateID] = thisSettings; | ||
844 | 981 | ||
845 | ScenePresence s = Scene.GetScenePresence(user); | 982 | ScenePresence s = Scene.GetScenePresence(user); |
846 | if (s != null) | 983 | if (s != null) |
847 | { | ||
848 | if (!s.IsChildAgent) | ||
849 | { | 984 | { |
850 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) | 985 | if (!s.IsChildAgent) |
851 | { | 986 | { |
852 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | 987 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
853 | Scene.CloseAgent(s.UUID, false); | 988 | { |
989 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
990 | Scene.CloseAgent(s.UUID, false); | ||
991 | } | ||
854 | } | 992 | } |
855 | } | 993 | } |
856 | } | 994 | } |
857 | 995 | else | |
858 | } | 996 | { |
859 | else | 997 | remote_client.SendAlertMessage("User is already on the region ban list"); |
860 | { | 998 | } |
861 | remote_client.SendAlertMessage("User is already on the region ban list"); | 999 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
1000 | if(needReply) | ||
1001 | sendAllowedOrBanList[remote_client] = invoice; | ||
862 | } | 1002 | } |
863 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); | ||
864 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | ||
865 | } | 1003 | } |
866 | else | ||
867 | { | ||
868 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
869 | } | ||
870 | } | ||
871 | 1004 | ||
872 | if ((estateAccessType & 128) != 0) // Ban remove | 1005 | if ((estateAccessType & 128) != 0) // Ban remove |
873 | { | ||
874 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) | ||
875 | { | 1006 | { |
876 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; | 1007 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; |
877 | 1008 | ||
@@ -890,104 +1021,90 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
890 | 1021 | ||
891 | if (alreadyInList && listitem != null) | 1022 | if (alreadyInList && listitem != null) |
892 | { | 1023 | { |
893 | if ((estateAccessType & 1) != 0) // All estates | 1024 | if (doOtherEstates) // All estates |
894 | { | 1025 | { |
895 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 1026 | foreach (EstateSettings estateSettings in otherEstates) |
896 | EstateSettings estateSettings; | ||
897 | |||
898 | foreach (int estateID in estateIDs) | ||
899 | { | 1027 | { |
900 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 1028 | if(!isadmin && !estateSettings.IsEstateManagerOrOwner(agentID)) |
901 | { | 1029 | continue; |
902 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 1030 | estateSettings.RemoveBan(user); |
903 | estateSettings.RemoveBan(user); | 1031 | changed[(int)estateSettings.EstateID] = estateSettings; |
904 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | ||
905 | } | ||
906 | } | 1032 | } |
907 | } | 1033 | } |
908 | 1034 | ||
909 | Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); | 1035 | thisSettings.RemoveBan(listitem.BannedUserID); |
910 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 1036 | changed[thisEstateID] = thisSettings; |
911 | |||
912 | TriggerEstateInfoChange(); | ||
913 | } | 1037 | } |
914 | else | 1038 | else |
915 | { | 1039 | { |
916 | remote_client.SendAlertMessage("User is not on the region ban list"); | 1040 | remote_client.SendAlertMessage("User is not on the region ban list"); |
917 | } | 1041 | } |
918 | 1042 | ||
919 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); | 1043 | if(needReply) |
920 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 1044 | sendAllowedOrBanList[remote_client] = invoice; |
921 | } | 1045 | } |
922 | else | 1046 | |
1047 | // last the ones only for owners of this region | ||
1048 | if (!Scene.Permissions.CanIssueEstateCommand(agentID, true)) | ||
923 | { | 1049 | { |
924 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 1050 | remote_client.SendAlertMessage("Method EstateAccess Failed, you don't have permissions"); |
1051 | continue; | ||
925 | } | 1052 | } |
926 | } | ||
927 | 1053 | ||
928 | if ((estateAccessType & 256) != 0) // Manager add | 1054 | if ((estateAccessType & 256) != 0) // Manager add |
929 | { | ||
930 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | ||
931 | { | 1055 | { |
932 | if ((estateAccessType & 1) != 0) // All estates | 1056 | if(thisSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers) |
933 | { | 1057 | { |
934 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 1058 | if(!sentManagersFull) |
935 | EstateSettings estateSettings; | ||
936 | |||
937 | foreach (int estateID in estateIDs) | ||
938 | { | 1059 | { |
939 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 1060 | sentManagersFull = true; |
1061 | remote_client.SendAlertMessage("Estate Managers list is full"); | ||
1062 | } | ||
1063 | } | ||
1064 | else | ||
1065 | { | ||
1066 | if (doOtherEstates) // All estates | ||
1067 | { | ||
1068 | foreach (EstateSettings estateSettings in otherEstates) | ||
940 | { | 1069 | { |
941 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 1070 | if(!isadmin && !estateSettings.IsEstateOwner(agentID)) // redundante check? |
1071 | continue; | ||
1072 | if(estateSettings.EstateManagersCount() >= (int)Constants.EstateAccessLimits.EstateManagers) | ||
1073 | continue; | ||
942 | estateSettings.AddEstateManager(user); | 1074 | estateSettings.AddEstateManager(user); |
943 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 1075 | changed[(int)estateSettings.EstateID] = estateSettings; |
944 | } | 1076 | } |
945 | } | 1077 | } |
946 | } | ||
947 | 1078 | ||
948 | Scene.RegionInfo.EstateSettings.AddEstateManager(user); | 1079 | thisSettings.AddEstateManager(user); |
949 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 1080 | changed[thisEstateID] = thisSettings; |
950 | 1081 | ||
951 | TriggerEstateInfoChange(); | 1082 | sendManagers[remote_client] = invoice; |
952 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | 1083 | } |
953 | } | ||
954 | else | ||
955 | { | ||
956 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
957 | } | 1084 | } |
958 | } | ||
959 | 1085 | ||
960 | if ((estateAccessType & 512) != 0) // Manager remove | 1086 | if ((estateAccessType & 512) != 0) // Manager remove |
961 | { | ||
962 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) | ||
963 | { | 1087 | { |
964 | if ((estateAccessType & 1) != 0) // All estates | 1088 | if (doOtherEstates) // All estates |
965 | { | 1089 | { |
966 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | 1090 | foreach (EstateSettings estateSettings in otherEstates) |
967 | EstateSettings estateSettings; | ||
968 | |||
969 | foreach (int estateID in estateIDs) | ||
970 | { | 1091 | { |
971 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | 1092 | if(!isadmin && !estateSettings.IsEstateOwner(agentID)) |
972 | { | 1093 | continue; |
973 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | 1094 | |
974 | estateSettings.RemoveEstateManager(user); | 1095 | estateSettings.RemoveEstateManager(user); |
975 | Scene.EstateDataService.StoreEstateSettings(estateSettings); | 1096 | changed[(int)estateSettings.EstateID] = estateSettings; |
976 | } | ||
977 | } | 1097 | } |
978 | } | 1098 | } |
979 | 1099 | ||
980 | Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); | 1100 | thisSettings.RemoveEstateManager(user); |
981 | Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); | 1101 | changed[thisEstateID] = thisSettings; |
982 | 1102 | ||
983 | TriggerEstateInfoChange(); | 1103 | sendManagers[remote_client] = invoice; |
984 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | ||
985 | } | ||
986 | else | ||
987 | { | ||
988 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
989 | } | 1104 | } |
990 | } | 1105 | } |
1106 | lock(deltareqLock) | ||
1107 | runnigDeltaExec = false; | ||
991 | } | 1108 | } |
992 | 1109 | ||
993 | public void HandleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 1110 | public void HandleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |