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 /OpenSim/Region/CoreModules | |
parent | ignore prims with shape type none on max size check for physics (diff) | |
download | opensim-SC-d550b485f1409030149447c71b3de881232d4897.zip opensim-SC-d550b485f1409030149447c71b3de881232d4897.tar.gz opensim-SC-d550b485f1409030149447c71b3de881232d4897.tar.bz2 opensim-SC-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
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 527 |
1 files changed, 322 insertions, 205 deletions
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) |