Beispiel #1
0
        /// <summary>
        /// Loads the security configuration.
        /// </summary>
        /// <param name="wiki">The wiki.</param>
        private void LoadSecurityConfig(string currentWiki)
        {
            chkAllowUsersToRegister.Checked = Settings.UsersCanRegister(currentWiki);
            PopulateAccountActivationMode(Settings.GetAccountActivationMode(currentWiki));
            PopulateDefaultGroups(Settings.GetUsersGroup(currentWiki),
                                  Settings.GetAdministratorsGroup(currentWiki),
                                  Settings.GetAnonymousGroup(currentWiki));
            chkEnableCaptchaControl.Checked     = !Settings.GetDisableCaptchaControl(currentWiki);
            chkPreventConcurrentEditing.Checked = Settings.GetDisableConcurrentEditing(currentWiki);

            switch (Settings.GetModerationMode(currentWiki))
            {
            case ChangeModerationMode.None:
                rdoNoModeration.Checked = true;
                break;

            case ChangeModerationMode.RequirePageViewingPermissions:
                rdoRequirePageViewingPermissions.Checked = true;
                break;

            case ChangeModerationMode.RequirePageEditingPermissions:
                rdoRequirePageEditingPermissions.Checked = true;
                break;
            }

            txtExtensionsAllowed.Text = string.Join(", ", Settings.GetAllowedFileTypes(currentWiki));

            lstFileDownloadCountFilterMode.SelectedIndex = -1;
            switch (Settings.GetFileDownloadCountFilterMode(currentWiki))
            {
            case FileDownloadCountFilterMode.CountAll:
                lstFileDownloadCountFilterMode.SelectedIndex = 0;
                txtFileDownloadCountFilter.Enabled           = false;
                break;

            case FileDownloadCountFilterMode.CountSpecifiedExtensions:
                lstFileDownloadCountFilterMode.SelectedIndex = 1;
                txtFileDownloadCountFilter.Enabled           = true;
                txtFileDownloadCountFilter.Text = string.Join(", ", Settings.GetFileDownloadCountFilter(currentWiki));
                break;

            case FileDownloadCountFilterMode.ExcludeSpecifiedExtensions:
                txtFileDownloadCountFilter.Text              = string.Join(", ", Settings.GetFileDownloadCountFilter(currentWiki));
                txtFileDownloadCountFilter.Enabled           = true;
                lstFileDownloadCountFilterMode.SelectedIndex = 2;
                break;

            default:
                throw new NotSupportedException();
            }

            chkAllowScriptTags.Checked = Settings.GetScriptTagsAllowed(currentWiki);
            txtIpHostFilter.Text       = Settings.GetIpHostFilter(currentWiki);
        }