SaveGatewayRules() 공개 정적인 메소드

public static SaveGatewayRules ( List rules ) : void
rules List
리턴 void
예제 #1
0
        private bool Save()
        {
            int port = 0;

            try
            {
                port = Convert.ToInt32(this.portTB.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("The port must be a positive integer.");
                return(false);
            }

            Settings.Store.Host = this.hostTB.Text.Trim();
            Settings.Store.Port = port;
            Settings.Store.User = this.userTB.Text.Trim();
            Settings.Store.SetEncryptedSetting("Password", this.passwordTB.Text);
            Settings.Store.Database = this.dbTB.Text.Trim();
            Settings.Store.UseSsl   = this.useSslCB.Checked;

            // User table settings
            Settings.Store.Table                     = this.userTableTB.Text.Trim();
            Settings.Store.UsernameColumn            = this.unameColTB.Text.Trim();
            Settings.Store.HashMethodColumn          = this.hashMethodColTB.Text.Trim();
            Settings.Store.PasswordColumn            = this.passwdColTB.Text.Trim();
            Settings.Store.UserTablePrimaryKeyColumn = this.userPrimaryKeyColTB.Text.Trim();

            if (encHexRB.Checked)
            {
                Settings.Store.HashEncoding = (int)Settings.HashEncoding.HEX;
            }
            else
            {
                Settings.Store.HashEncoding = (int)Settings.HashEncoding.BASE_64;
            }

            // Group table schema settings
            Settings.Store.GroupTableName             = this.groupTableNameTB.Text.Trim();
            Settings.Store.GroupNameColumn            = this.groupNameColTB.Text.Trim();
            Settings.Store.GroupTablePrimaryKeyColumn = this.groupTablePrimaryKeyColTB.Text.Trim();

            // User-Group table settings
            Settings.Store.UserGroupTableName    = this.userGroupTableNameTB.Text.Trim();
            Settings.Store.UserForeignKeyColumn  = this.userGroupUserFKColTB.Text.Trim();
            Settings.Store.GroupForeignKeyColumn = this.userGroupGroupFKColTB.Text.Trim();

            // Gateway rules
            List <GroupGatewayRule> gwList = new List <GroupGatewayRule>();

            foreach (Object item in this.gtwRulesListBox.Items)
            {
                gwList.Add(item as GroupGatewayRule);
            }
            GroupRuleLoader.SaveGatewayRules(gwList);

            return(true);
        }
예제 #2
0
        private bool Save()
        {
            int port = 0;
            try
            {
                port = Convert.ToInt32(this.portTB.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("The port must be a positive integer.");
                return false;
            }

            Settings.Store.Host = this.hostTB.Text.Trim();
            Settings.Store.Port = port;
            Settings.Store.User = this.userTB.Text.Trim();
            Settings.Store.SetEncryptedSetting("Password", this.passwordTB.Text);
            Settings.Store.Database = this.dbTB.Text.Trim();
            Settings.Store.UseSsl = this.useSslCB.Checked;

            // User table settings
            Settings.Store.Table = this.userTableTB.Text.Trim();
            Settings.Store.UsernameColumn = this.unameColTB.Text.Trim();
            Settings.Store.HashMethodColumn = this.hashMethodColTB.Text.Trim();
            Settings.Store.PasswordColumn = this.passwdColTB.Text.Trim();
            Settings.Store.UserTablePrimaryKeyColumn = this.userPrimaryKeyColTB.Text.Trim();

            if (encHexRB.Checked)
                Settings.Store.HashEncoding = (int)Settings.HashEncoding.HEX;
            else
                Settings.Store.HashEncoding = (int)Settings.HashEncoding.BASE_64;

            // Group table schema settings
            Settings.Store.GroupTableName = this.groupTableNameTB.Text.Trim();
            Settings.Store.GroupNameColumn = this.groupNameColTB.Text.Trim();
            Settings.Store.GroupTablePrimaryKeyColumn = this.groupTablePrimaryKeyColTB.Text.Trim();

            // User-Group table settings
            Settings.Store.UserGroupTableName = this.userGroupTableNameTB.Text.Trim();
            Settings.Store.UserForeignKeyColumn = this.userGroupUserFKColTB.Text.Trim();
            Settings.Store.GroupForeignKeyColumn = this.userGroupGroupFKColTB.Text.Trim();

            ////////// Authorization Tab ////////////
            Settings.Store.AuthzRequireMySqlAuth = this.ckDenyWhenMySqlAuthFails.Checked;
            List<GroupAuthzRule> lst = new List<GroupAuthzRule>();
            foreach (Object item in this.listBoxAuthzRules.Items)
            {
                lst.Add(item as GroupAuthzRule);
                m_logger.DebugFormat("Saving rule: {0}", item);
            }
            // Add the default as the last rule in the list
            lst.Add(new GroupAuthzRule(this.rbDefaultAllow.Checked));

            GroupRuleLoader.SaveAuthzRules(lst);

            // Gateway rules
            List<GroupGatewayRule> gwList = new List<GroupGatewayRule>();
            foreach (Object item in this.gtwRulesListBox.Items)
            {
                gwList.Add(item as GroupGatewayRule);
            }
            GroupRuleLoader.SaveGatewayRules(gwList);

            Settings.Store.PreventLogonOnServerError = m_preventLogonWhenServerUnreachableCb.Checked;

            return true;
        }