public void Page_Load(object sender, EventArgs e)
        {
            if (!Main.Context.AdminApi.IsPluginAuthorized)
            {
                HttpContext.Current.Response.Write("<h1>未授权访问</h1>");
                HttpContext.Current.Response.End();
                return;
            }

            _config = Main.GetConfig();

            if (IsPostBack)
            {
                return;
            }

            RblIpRestrictionType.Items.Add(new ListItem
            {
                Text     = ERestrictionTypeUtils.GetText(ERestrictionType.None),
                Value    = ERestrictionTypeUtils.GetValue(ERestrictionType.None),
                Selected = ERestrictionTypeUtils.Equals(ERestrictionType.None, _config.IpRestrictionType)
            });
            RblIpRestrictionType.Items.Add(new ListItem
            {
                Text     = ERestrictionTypeUtils.GetText(ERestrictionType.BlackList),
                Value    = ERestrictionTypeUtils.GetValue(ERestrictionType.BlackList),
                Selected = ERestrictionTypeUtils.Equals(ERestrictionType.BlackList, _config.IpRestrictionType)
            });
            RblIpRestrictionType.Items.Add(new ListItem
            {
                Text     = ERestrictionTypeUtils.GetText(ERestrictionType.WhiteList),
                Value    = ERestrictionTypeUtils.GetValue(ERestrictionType.WhiteList),
                Selected = ERestrictionTypeUtils.Equals(ERestrictionType.WhiteList, _config.IpRestrictionType)
            });

            DdlIsHostRestriction.Items.Add(new ListItem
            {
                Text     = "不设置",
                Value    = false.ToString(),
                Selected = !_config.IsHostRestriction
            });
            DdlIsHostRestriction.Items.Add(new ListItem
            {
                Text     = "设置",
                Value    = true.ToString(),
                Selected = _config.IsHostRestriction
            });

            PhHost.Visible = _config.IsHostRestriction;
            TbHost.Text    = _config.Host;
        }
Exemple #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                BreadCrumbSettings(AppManager.Settings.LeftMenu.Restriction, "访问限制选项", AppManager.Settings.Permission.SettingsRestriction);

                ERestrictionTypeUtils.AddListItems(RestrictionType);
                ControlUtils.SelectListItemsIgnoreCase(RestrictionType, ERestrictionTypeUtils.GetValue(ConfigManager.SystemConfigInfo.RestrictionType));
            }
        }
Exemple #3
0
        public void Startup(IContext context, IService service)
        {
            Context = context;
            _config = Context.ConfigApi.GetConfig <Config>(0) ?? new Config
            {
                IpRestrictionType = ERestrictionTypeUtils.GetValue(ERestrictionType.None),
                IpBlackList       = string.Empty,
                IpWhiteList       = string.Empty
            };
            if (_config.IpBlackList == null)
            {
                _config.IpBlackList = string.Empty;
            }
            if (_config.IpWhiteList == null)
            {
                _config.IpWhiteList = string.Empty;
            }

            service.AddPluginMenu(PluginMenu);
        }
Exemple #4
0
        public override void Startup(IService service)
        {
            _config = ConfigApi.GetConfig <Config>(0) ?? new Config
            {
                IpRestrictionType = ERestrictionTypeUtils.GetValue(ERestrictionType.None),
                IpBlackList       = string.Empty,
                IpWhiteList       = string.Empty
            };
            if (_config.IpBlackList == null)
            {
                _config.IpBlackList = string.Empty;
            }
            if (_config.IpWhiteList == null)
            {
                _config.IpWhiteList = string.Empty;
            }

            service.AddPluginMenu(PluginMenu);

            Instance = this;
        }