コード例 #1
0
        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 == m_scene.RegionInfo.EstateSettings.EstateOwner)
                return; // never process EO

            IEstateConnector connector = Framework.Utilities.DataManager.RequestPlugin<IEstateConnector>();
            List<EstateSettings> estates = new List<EstateSettings>();
            if ((estateAccessType & (int)AccessDeltaRequest.ApplyToAllEstates) != 0 && connector != null)
                estates = connector.GetEstates(m_scene.RegionInfo.EstateSettings.EstateOwner);
            else
                estates = new List<EstateSettings>() { m_scene.RegionInfo.EstateSettings };

            bool moreToCome = (estateAccessType & (int)AccessDeltaRequest.MoreToCome) != 0;
            List<Action<UUID>> actions = new List<Action<UUID>>();
            bool isOwner = m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) ||
                       m_scene.Permissions.BypassPermissions();
            bool isManager = m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false);

            foreach (EstateSettings es in estates)
            {
                if (isOwner)
                {
                    if ((estateAccessType & (int)AccessDeltaRequest.AddEstateManager) != 0)
                        actions.Add(es.AddEstateManager);
                    else if ((estateAccessType & (int)AccessDeltaRequest.RemoveEstateManager) != 0)
                        actions.Add(es.RemoveEstateManager);
                }
                if (isManager)
                {
                    if ((estateAccessType & (int)AccessDeltaRequest.AddAllowedUser) != 0)
                        actions.Add(es.AddEstateUser);
                    else if ((estateAccessType & (int)AccessDeltaRequest.RemoveAllowedUser) != 0)
                        actions.Add(es.RemoveEstateUser);
                    else if ((estateAccessType & (int)AccessDeltaRequest.AddAllowedGroup) != 0)
                        actions.Add(es.AddEstateGroup);
                    else if ((estateAccessType & (int)AccessDeltaRequest.RemoveAllowedGroup) != 0)
                        actions.Add(es.RemoveEstateGroup);
                    else if ((estateAccessType & (int)AccessDeltaRequest.AddBannedUser) != 0)
                        actions.Add((userID) =>
                        {
                            IScenePresence SP = m_scene.GetScenePresence(user);
                            EstateBan item = new EstateBan
                            {
                                BannedUserID = userID,
                                EstateID = es.EstateID,
                                BannedHostAddress = "0.0.0.0",
                                BannedHostIPMask = (SP != null)
                                                        ? ((System.Net.IPEndPoint)SP.ControllingClient.GetClientEP())
                                                              .Address.ToString()
                                                        : "0.0.0.0"
                            };

                            es.AddBan(item);

                            IEntityTransferModule transferModule =
                                    m_scene.RequestModuleInterface<IEntityTransferModule>();
                            if (SP != null && transferModule != null)
                            {
                                if (!SP.IsChildAgent)
                                    transferModule.TeleportHome(user, SP.ControllingClient);
                                else
                                    transferModule.IncomingCloseAgent(SP.Scene, SP.UUID);
                            }
                        });
                    else if ((estateAccessType & (int)AccessDeltaRequest.RemoveBannedUser) != 0)
                        actions.Add(es.RemoveBan);
                }
            }

            foreach (Action<UUID> es in actions)
            {
                es(user);

                if (!moreToCome)
                    connector.SaveEstateSettings(m_scene.RegionInfo.EstateSettings);
            }
            if(actions.Count > 0)
                TriggerEstateInfoChange();

            if (!isManager && !isOwner)
                remote_client.SendAlertMessage("You don't have the correct permissions to accomplish this action.");

            if ((estateAccessType & (int) AccessDeltaRequest.MoreToCome) == 0) //1024 means more than one is being sent
            {
                remote_client.SendEstateList(invoice, (int) EstateTools.EstateAccessReplyDelta.AllowedUsers,
                                             m_scene.RegionInfo.EstateSettings.EstateAccess,
                                             m_scene.RegionInfo.EstateSettings.EstateID);
                remote_client.SendEstateList(invoice, (int) EstateTools.EstateAccessReplyDelta.AllowedGroups,
                                             m_scene.RegionInfo.EstateSettings.EstateGroups,
                                             m_scene.RegionInfo.EstateSettings.EstateID);
                remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans,
                                                 m_scene.RegionInfo.EstateSettings.EstateID);
                remote_client.SendEstateList(invoice, (int) EstateTools.EstateAccessReplyDelta.EstateManagers,
                                             m_scene.RegionInfo.EstateSettings.EstateManagers,
                                             m_scene.RegionInfo.EstateSettings.EstateID);
            }
        }
コード例 #2
0
        public void AddBan(EstateBan ban)
        {
            if (ban == null)
                return;

            if (!IsBanned(ban.BannedUserID))
                l_EstateBans.Add(ban);
        }
コード例 #3
0
        protected void SetRegionInfoOption(IScene scene, string[] cmdparams)
        {
            #region 3 Params needed

            if (cmdparams.Length < 4)
            {
                MainConsole.Instance.Warn ("Not enough parameters!");
                return;
            }
            if (cmdparams [2] == "Maturity")
            {
                switch (cmdparams [3])
                {
                case "PG":
                    m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel (0);
                    break;
                case "Mature":
                    m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel (1);
                    break;
                case "Adult":
                    m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel (2);
                    break;
                default:
                    MainConsole.Instance.Warn (
                        "Your parameter did not match any existing parameters. Try PG, Mature, or Adult");
                    return;
                }
                //Tell the grid about the changes
                IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface<IGridRegisterModule> ();
                if (gridRegModule != null)
                    gridRegModule.UpdateGridRegion (m_scene);
            }

            #endregion

            #region 4 Params needed

            if (cmdparams.Length < 4)
            {
                MainConsole.Instance.Warn ("Not enough parameters!");
                return;
            }

            var  account = m_scene.UserAccountService.GetUserAccount (null, cmdparams [3], cmdparams [4]);
            if (account != null) {
                var userID = account.PrincipalID;

                if (cmdparams [2] == "AddEstateBan".ToLower ()) {
                    EstateBan EB = new EstateBan { BannedUserID = userID };
                    m_scene.RegionInfo.EstateSettings.AddBan (EB);
                }
                if (cmdparams [2] == "AddEstateManager".ToLower ())
                    m_scene.RegionInfo.EstateSettings.AddEstateManager (userID);

                if (cmdparams [2] == "AddEstateAccess".ToLower ())
                    m_scene.RegionInfo.EstateSettings.AddEstateUser (userID);

                if (cmdparams [2] == "RemoveEstateBan".ToLower ())
                    m_scene.RegionInfo.EstateSettings.RemoveBan (userID);

                if (cmdparams [2] == "RemoveEstateManager".ToLower ())
                    m_scene.RegionInfo.EstateSettings.RemoveEstateManager (userID);

                if (cmdparams [2] == "RemoveEstateAccess".ToLower ())
                    m_scene.RegionInfo.EstateSettings.RemoveEstateUser (userID);

                Framework.Utilities.DataManager.RequestPlugin<IEstateConnector> ().SaveEstateSettings (m_scene.RegionInfo.EstateSettings);
            }
            #endregion
        }
コード例 #4
0
        public override void FromOSD(OSDMap v)
        {
            OSDMap values = (OSDMap) v;
            EstateID = (uint) values["EstateID"].AsInteger();
            EstateName = values["EstateName"].AsString();
            AbuseEmailToEstateOwner = values["AbuseEmailToEstateOwner"].AsBoolean();
            DenyAnonymous = values["DenyAnonymous"].AsBoolean();
            ResetHomeOnTeleport = values["ResetHomeOnTeleport"].AsBoolean();
            FixedSun = values["FixedSun"].AsBoolean();
            DenyTransacted = values["DenyTransacted"].AsBoolean();
            BlockDwell = values["BlockDwell"].AsBoolean();
            DenyIdentified = values["DenyIdentified"].AsBoolean();
            AllowVoice = values["AllowVoice"].AsBoolean();
            UseGlobalTime = values["UseGlobalTime"].AsBoolean();
            PricePerMeter = values["PricePerMeter"].AsInteger();
            TaxFree = values["TaxFree"].AsBoolean();
            AllowDirectTeleport = values["AllowDirectTeleport"].AsBoolean();
            ParentEstateID = (uint) values["ParentEstateID"].AsInteger();
            SunPosition = values["SunPosition"].AsReal();
            EstateSkipScripts = values["EstateSkipScripts"].AsBoolean();
            BillableFactor = (float) values["BillableFactor"].AsReal();
            PublicAccess = values["PublicAccess"].AsBoolean();
            AbuseEmail = values["AbuseEmail"].AsString();
            EstateOwner = values["EstateOwner"].AsUUID();
            AllowLandmark = values["AllowLandmark"].AsBoolean();
            AllowParcelChanges = values["AllowParcelChanges"].AsBoolean();
            AllowSetHome = values["AllowSetHome"].AsBoolean();
            DenyMinors = values["DenyMinors"].AsBoolean();

            OSDArray Managers = values["EstateManagers"] as OSDArray;
            if (Managers != null)
                EstateManagers = Managers.ConvertAll<UUID>((o) => o);

            OSDArray Ban = values["EstateBans"] as OSDArray;
            if (Ban != null)
                EstateBans = Ban.ConvertAll<EstateBan>((o) =>
                                                           {
                                                               EstateBan ban = new EstateBan();
                                                               ban.FromOSD(o);
                                                               return ban;
                                                           });

            OSDArray Access = values["EstateAccess"] as OSDArray;
            if (Access != null)
                EstateAccess = Access.ConvertAll<UUID>((o) => o);

            OSDArray Groups = values["EstateGroups"] as OSDArray;
            if (Groups != null)
                EstateGroups = Groups.ConvertAll<UUID>((o) => o);
        }