From 9f8138b2d0d14f0182893562288707e842a3853c Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Sun, 6 Dec 2020 10:46:04 +0100 Subject: [PATCH] Adhered to linting rules configuration models, validators and tests. --- .../Configuration/IPasswordConfiguration.cs | 36 +++++- .../Models/ActiveDirectorySettings.cs | 11 +- .../Configuration/Models/ConnectionStrings.cs | 13 ++- .../Configuration/Models/ContentErrorPage.cs | 35 +++++- .../Models/ContentImagingSettings.cs | 20 +++- .../Models/ContentNotificationSettings.cs | 14 ++- .../Configuration/Models/ContentSettings.cs | 41 ++++++- .../Configuration/Models/CoreDebugSettings.cs | 16 ++- .../Models/DatabaseServerMessengerSettings.cs | 16 ++- .../Models/DatabaseServerRegistrarSettings.cs | 12 +- .../Models/DisabledHealthCheckSettings.cs | 17 ++- .../Models/ExceptionFilterSettings.cs | 11 +- .../Configuration/Models/GlobalSettings.cs | 107 +++++++++++++++--- .../HealthChecksNotificationMethodSettings.cs | 20 +++- .../HealthChecksNotificationSettings.cs | 23 +++- .../Models/HealthChecksSettings.cs | 14 ++- .../Configuration/Models/HostingSettings.cs | 13 ++- .../Models/ImagingAutoFillUploadField.cs | 23 +++- .../Models/ImagingCacheSettings.cs | 23 +++- .../Models/ImagingResizeSettings.cs | 14 ++- .../Configuration/Models/ImagingSettings.cs | 14 ++- .../Models/IndexCreatorSettings.cs | 11 +- .../Configuration/Models/KeepAliveSettings.cs | 12 ++ .../Configuration/Models/LoggingSettings.cs | 11 +- .../MemberPasswordConfigurationSettings.cs | 15 ++- .../Models/ModelsBuilderSettings.cs | 40 +++---- .../Configuration/Models/NuCacheSettings.cs | 13 ++- .../Models/RequestHandlerSettings.cs | 81 ++++++++----- .../Configuration/Models/RuntimeSettings.cs | 14 ++- .../Configuration/Models/SecuritySettings.cs | 32 +++++- .../Configuration/Models/SmtpSettings.cs | 54 ++++++++- .../Configuration/Models/TourSettings.cs | 11 +- .../Models/TypeFinderSettings.cs | 11 +- .../UserPasswordConfigurationSettings.cs | 15 ++- .../Validation/ConfigurationValidatorBase.cs | 34 +++++- .../Validation/ContentSettingsValidator.cs | 24 ++-- .../Validation/GlobalSettingsValidator.cs | 15 ++- .../HealthChecksSettingsValidator.cs | 26 +++-- .../RequestHandlerSettingsValidator.cs | 9 +- .../Models/Validation/ValidatableEntryBase.cs | 8 +- .../Models/WebRoutingSettings.cs | 32 +++++- src/Umbraco.Infrastructure/Scoping/Scope.cs | 2 +- .../GlobalSettingsValidatorTests.cs | 20 ++-- .../HealthChecksSettingsValidatorTests.cs | 20 ++-- .../RequestHandlerSettingsValidatorTests.cs | 10 +- 45 files changed, 840 insertions(+), 173 deletions(-) diff --git a/src/Umbraco.Core/Configuration/IPasswordConfiguration.cs b/src/Umbraco.Core/Configuration/IPasswordConfiguration.cs index 6a5fd8e73f..0c143f22e6 100644 --- a/src/Umbraco.Core/Configuration/IPasswordConfiguration.cs +++ b/src/Umbraco.Core/Configuration/IPasswordConfiguration.cs @@ -1,19 +1,49 @@ -namespace Umbraco.Core.Configuration -{ +// Copyright (c) Umbraco. +// See LICENSE for more details. +namespace Umbraco.Core.Configuration +{ /// /// Password configuration /// public interface IPasswordConfiguration { + /// + /// Gets a value for the minimum required length for the password. + /// int RequiredLength { get; } + + /// + /// Gets a value indicating whether at least one non-letter or digit is required for the password. + /// bool RequireNonLetterOrDigit { get; } + + /// + /// Gets a value indicating whether at least one digit is required for the password. + /// bool RequireDigit { get; } + + /// + /// Gets a value indicating whether at least one lower-case character is required for the password. + /// bool RequireLowercase { get; } + + /// + /// Gets a value indicating whether at least one upper-case character is required for the password. + /// bool RequireUppercase { get; } + + /// + /// Gets a value for the password hash algorithm type. + /// string HashAlgorithmType { get; } - // TODO: This doesn't really belong here + /// + /// Gets a value for the maximum failed access attempts before lockout. + /// + /// + /// TODO: This doesn't really belong here + /// int MaxFailedAccessAttemptsBeforeLockout { get; } } } diff --git a/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs index 0fe541416a..135b8b763c 100644 --- a/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ActiveDirectorySettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for active directory settings. + /// public class ActiveDirectorySettings { + /// + /// Gets or sets a value for the Active Directory domain. + /// public string Domain { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs b/src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs index d21cba4486..52b8a02478 100644 --- a/src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs +++ b/src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs @@ -1,19 +1,30 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for connection strings. + /// public class ConnectionStrings { // Backing field for UmbracoConnectionString to load from configuration value with key umbracoDbDSN. // Attributes cannot be applied to map from keys that don't match, and have chosen to retain the key name // used in configuration for older Umbraco versions. // See: https://stackoverflow.com/a/54607296/489433 +#pragma warning disable SA1300 // Element should begin with upper-case letter +#pragma warning disable IDE1006 // Naming Styles private string umbracoDbDSN +#pragma warning restore IDE1006 // Naming Styles +#pragma warning restore SA1300 // Element should begin with upper-case letter { get => UmbracoConnectionString?.ConnectionString; set => UmbracoConnectionString = new ConfigConnectionString(Constants.System.UmbracoConnectionName, value); } + /// + /// Gets or sets a value for the Umbraco database connection string.. + /// public ConfigConnectionString UmbracoConnectionString { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs b/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs index 6a362c93a3..842b2e6fb7 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs @@ -1,30 +1,55 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.ComponentModel.DataAnnotations; using Umbraco.Core.Configuration.Models.Validation; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration for a content error page. + /// public class ContentErrorPage : ValidatableEntryBase { + /// + /// Gets or sets a value for the content Id. + /// public int ContentId { get; set; } + /// + /// Gets or sets a value for the content key. + /// public Guid ContentKey { get; set; } + /// + /// Gets or sets a value for the content XPath. + /// public string ContentXPath { get; set; } + /// + /// Gets a value indicating whether the field is populated. + /// public bool HasContentId => ContentId != 0; + /// + /// Gets a value indicating whether the field is populated. + /// public bool HasContentKey => ContentKey != Guid.Empty; + /// + /// Gets a value indicating whether the field is populated. + /// public bool HasContentXPath => !string.IsNullOrEmpty(ContentXPath); + /// + /// Gets or sets a value for the content culture. + /// [Required] public string Culture { get; set; } - internal override bool IsValid() - { - return base.IsValid() && + internal override bool IsValid() => + base.IsValid() && ((HasContentId ? 1 : 0) + (HasContentKey ? 1 : 0) + (HasContentXPath ? 1 : 0) == 1); - } } } diff --git a/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs index 7c1e570426..d31c5cb6d7 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs @@ -1,9 +1,15 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for content imaging settings. + /// public class ContentImagingSettings { - private static readonly ImagingAutoFillUploadField[] DefaultImagingAutoFillUploadField = -{ + private static readonly ImagingAutoFillUploadField[] s_defaultImagingAutoFillUploadField = + { new ImagingAutoFillUploadField { Alias = Constants.Conventions.Media.File, @@ -14,8 +20,14 @@ } }; + /// + /// Gets or sets a value for the collection of accepted image file extensions. + /// public string[] ImageFileTypes { get; set; } = new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" }; - public ImagingAutoFillUploadField[] AutoFillImageProperties { get; set; } = DefaultImagingAutoFillUploadField; + /// + /// Gets or sets a value for the imaging autofill following media file upload fields. + /// + public ImagingAutoFillUploadField[] AutoFillImageProperties { get; set; } = s_defaultImagingAutoFillUploadField; } } diff --git a/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs index ab1c10ff77..48a131adfa 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs @@ -1,9 +1,21 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for content notification settings. + /// public class ContentNotificationSettings { + /// + /// Gets or sets a value for the email address for notifications. + /// public string Email { get; set; } + /// + /// Gets or sets a value indicating whether HTML email notifications should be disabled. + /// public bool DisableHtmlEmail { get; set; } = false; } } diff --git a/src/Umbraco.Core/Configuration/Models/ContentSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs index c26e6d403a..55881cd8db 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs @@ -1,10 +1,15 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.Collections.Generic; -using Umbraco.Core.Configuration.Models.Validation; using Umbraco.Core.Macros; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for content settings. + /// public class ContentSettings { private const string DefaultPreviewBadge = @@ -142,26 +147,54 @@ namespace Umbraco.Core.Configuration.Models "; + /// + /// Gets or sets a value for the content notification settings. + /// public ContentNotificationSettings Notifications { get; set; } = new ContentNotificationSettings(); + /// + /// Gets or sets a value for the content imaging settings. + /// public ContentImagingSettings Imaging { get; set; } = new ContentImagingSettings(); + /// + /// Gets or sets a value indicating whether URLs should be resolved from text strings. + /// public bool ResolveUrlsFromTextString { get; set; } = false; + /// + /// Gets or sets a value for the collection of error pages. + /// public ContentErrorPage[] Error404Collection { get; set; } = Array.Empty(); + /// + /// Gets or sets a value for the preview badge mark-up. + /// public string PreviewBadge { get; set; } = DefaultPreviewBadge; + /// + /// Gets or sets a value for the macro error behaviour. + /// public MacroErrorBehaviour MacroErrors { get; set; } = MacroErrorBehaviour.Inline; + /// + /// Gets or sets a value for the collection of file extensions that are disallowed for upload. + /// public IEnumerable DisallowedUploadFiles { get; set; } = new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" }; + /// + /// Gets or sets a value for the collection of file extensions that are allowed for upload. + /// public IEnumerable AllowedUploadFiles { get; set; } = Array.Empty(); + /// + /// Gets or sets a value indicating whether deprecated property editors should be shown. + /// public bool ShowDeprecatedPropertyEditors { get; set; } = false; + /// + /// Gets or sets a value for the pate to the login screen background image. + /// public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg"; - - } } diff --git a/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs index 2b13609509..a263fb648a 100644 --- a/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs @@ -1,9 +1,21 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for core debug settings. + /// public class CoreDebugSettings { - public bool LogUncompletedScopes { get; set; } = false; + /// + /// Gets or sets a value indicating whether incompleted scopes should be logged. + /// + public bool LogIncompletedScopes { get; set; } = false; + /// + /// Gets or sets a value indicating whether memory dumps on thread abort should be taken. + /// public bool DumpOnTimeoutThreadAbort { get; set; } = false; } } diff --git a/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs b/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs index 32b957d5d0..8ad87bbb4e 100644 --- a/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs @@ -1,26 +1,32 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for database server messaging settings. + /// public class DatabaseServerMessengerSettings { /// - /// The maximum number of instructions that can be processed at startup; otherwise the server cold-boots (rebuilds its caches). + /// Gets or sets a value for the maximum number of instructions that can be processed at startup; otherwise the server cold-boots (rebuilds its caches). /// public int MaxProcessingInstructionCount { get; set; } = 1000; /// - /// The time to keep instructions in the database; records older than this number will be pruned. + /// Gets or sets a value for the time to keep instructions in the database; records older than this number will be pruned. /// public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.FromDays(2); /// - /// The time to wait between each sync operations. + /// Gets or sets a value for the time to wait between each sync operations. /// public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.FromSeconds(5); /// - /// The time to wait between each prune operations. + /// Gets or sets a value for the time to wait between each prune operations. /// public TimeSpan TimeBetweenPruneOperations { get; set; } = TimeSpan.FromMinutes(1); } diff --git a/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs b/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs index 1aa670fae6..ae2502d8af 100644 --- a/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs @@ -1,16 +1,22 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for database server registrar settings. + /// public class DatabaseServerRegistrarSettings { /// - /// The amount of time to wait between calls to the database on the background thread. + /// Gets or sets a value for the amount of time to wait between calls to the database on the background thread. /// public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.FromMinutes(1); /// - /// The time span to wait before considering a server stale, after it has last been accessed. + /// Gets or sets a value for the time span to wait before considering a server stale, after it has last been accessed. /// public TimeSpan StaleServerTimeout { get; set; } = TimeSpan.FromMinutes(2); } diff --git a/src/Umbraco.Core/Configuration/Models/DisabledHealthCheckSettings.cs b/src/Umbraco.Core/Configuration/Models/DisabledHealthCheckSettings.cs index 1d96a9027f..38c71fd83f 100644 --- a/src/Umbraco.Core/Configuration/Models/DisabledHealthCheckSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DisabledHealthCheckSettings.cs @@ -1,13 +1,28 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for disabled healthcheck settings. + /// public class DisabledHealthCheckSettings { + /// + /// Gets or sets a value for the healthcheck Id to disable. + /// public Guid Id { get; set; } + /// + /// Gets or sets a value for the date the healthcheck was disabled. + /// public DateTime DisabledOn { get; set; } + /// + /// Gets or sets a value for Id of the user that disabled the healthcheck. + /// public int DisabledBy { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs index 6b8f74bef0..1a1362ff21 100644 --- a/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for exception filter settings. + /// public class ExceptionFilterSettings { + /// + /// Gets or sets a value indicating whether the exception filter is disabled. + /// public bool Disabled { get; set; } = false; } } diff --git a/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs index b6e5cf2b4d..eb13427d2b 100644 --- a/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs @@ -1,68 +1,141 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { /// - /// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information - /// from web.config appsettings + /// Typed configuration options for global settings. /// public class GlobalSettings { internal const string - StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; //must end with a comma! + StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; // must end with a comma! internal const string - StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma! + StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; // must end with a comma! + /// + /// Gets or sets a value for the reserved URLs. + /// public string ReservedUrls { get; set; } = StaticReservedUrls; + /// + /// Gets or sets a value for the reserved paths. + /// public string ReservedPaths { get; set; } = StaticReservedPaths; - // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings - // TODO: previously this would throw on set, but presumably we can't do that if we do still want this in config. + /// + /// Gets or sets a value for the configuration status. + /// + /// + /// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings + /// TODO: previously this would throw on set, but presumably we can't do that if we do still want this in config. + /// public string ConfigurationStatus { get; set; } + /// + /// Gets or sets a value for the timeout in minutes. + /// public int TimeOutInMinutes { get; set; } = 20; + /// + /// Gets or sets a value for the default UI language. + /// public string DefaultUILanguage { get; set; } = "en-US"; + /// + /// Gets or sets a value indicating whether to hide the top level node from the path. + /// public bool HideTopLevelNodeFromPath { get; set; } = false; + /// + /// Gets or sets a value indicating whether HTTPS should be used. + /// public bool UseHttps { get; set; } = false; + /// + /// Gets or sets a value for the version check period in days. + /// public int VersionCheckPeriod { get; set; } = 7; + /// + /// Gets or sets a value for the Umbraco back-office path. + /// public string UmbracoPath { get; set; } = "~/umbraco"; - // TODO: Umbraco cannot be hard coded here that is what UmbracoPath is for - // so this should not be a normal get set it has to have dynamic ability to return the correct - // path given UmbracoPath if this hasn't been explicitly set. + /// + /// Gets or sets a value for the Umbraco icons path. + /// + /// + /// TODO: Umbraco cannot be hard coded here that is what UmbracoPath is for + /// so this should not be a normal get set it has to have dynamic ability to return the correct + /// path given UmbracoPath if this hasn't been explicitly set. + /// public string IconsPath { get; set; } = $"~/umbraco/assets/icons"; + /// + /// Gets or sets a value for the Umbraco CSS path. + /// public string UmbracoCssPath { get; set; } = "~/css"; + /// + /// Gets or sets a value for the Umbraco scripts path. + /// public string UmbracoScriptsPath { get; set; } = "~/scripts"; + /// + /// Gets or sets a value for the Umbraco media path. + /// public string UmbracoMediaPath { get; set; } = "~/media"; + /// + /// Gets or sets a value indicating whether to install the database when it is missing. + /// public bool InstallMissingDatabase { get; set; } = false; + /// + /// Gets or sets a value indicating whether to install the database when it is empty. + /// public bool InstallEmptyDatabase { get; set; } = false; + /// + /// Gets or sets a value indicating whether to disable the election for a single server. + /// public bool DisableElectionForSingleServer { get; set; } = false; - public DatabaseServerRegistrarSettings DatabaseServerRegistrar { get; set; } = new DatabaseServerRegistrarSettings(); - - public DatabaseServerMessengerSettings DatabaseServerMessenger { get; set; } = new DatabaseServerMessengerSettings(); - - public string RegisterType { get; set; } = string.Empty; - + /// + /// Gets or sets a value for the database factory server version. + /// public string DatabaseFactoryServerVersion { get; set; } = string.Empty; + /// + /// Gets or sets a value for the main dom lock. + /// public string MainDomLock { get; set; } = string.Empty; + /// + /// Gets or sets a value for the path to the no content view. + /// public string NoNodesViewPath { get; set; } = "~/umbraco/UmbracoWebsite/NoNodes.cshtml"; - public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host); + /// + /// Gets or sets a value for the database server registrar settings. + /// + public DatabaseServerRegistrarSettings DatabaseServerRegistrar { get; set; } = new DatabaseServerRegistrarSettings(); + /// + /// Gets or sets a value for the database server messenger settings. + /// + public DatabaseServerMessengerSettings DatabaseServerMessenger { get; set; } = new DatabaseServerMessengerSettings(); + + /// + /// Gets or sets a value for the SMTP settings. + /// public SmtpSettings Smtp { get; set; } + + /// + /// Gets a value indicating whether SMTP is configured. + /// + public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host); } } diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs index 1cfc4f9168..b4bffab4d6 100644 --- a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs @@ -1,16 +1,34 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; using Umbraco.Core.HealthCheck; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for healthcheck notification method settings. + /// public class HealthChecksNotificationMethodSettings { + /// + /// Gets or sets a value indicating whether the health check notification method is enabled. + /// public bool Enabled { get; set; } = false; + /// + /// Gets or sets a value for the health check notifications reporting verbosity. + /// public HealthCheckNotificationVerbosity Verbosity { get; set; } = HealthCheckNotificationVerbosity.Summary; + /// + /// Gets or sets a value indicating whether the health check notifications should occur on failures only. + /// public bool FailureOnly { get; set; } = false; + /// + /// Gets or sets a value providing provider specific settings for the health check notification method. + /// public IDictionary Settings { get; set; } = new Dictionary(); } } diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs index 052b5a4997..3e52a70b29 100644 --- a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs @@ -1,19 +1,40 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.Collections.Generic; using System.Linq; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for healthcheck notification settings. + /// public class HealthChecksNotificationSettings { + /// + /// Gets or sets a value indicating whether health check notifications are enabled. + /// public bool Enabled { get; set; } = false; + /// + /// Gets or sets a value for the first run time of a healthcheck notification in crontab format. + /// public string FirstRunTime { get; set; } = string.Empty; + /// + /// Gets or sets a value for the period of the healthcheck notification. + /// public TimeSpan Period { get; set; } = TimeSpan.FromHours(24); + /// + /// Gets or sets a value for the collection of health check notification methods. + /// public IDictionary NotificationMethods { get; set; } = new Dictionary(); + /// + /// Gets or sets a value for the collection of health checks that are disabled for notifications. + /// public IEnumerable DisabledChecks { get; set; } = Enumerable.Empty(); } } diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs index 705611b0c1..e3ae9a3f96 100644 --- a/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs @@ -1,12 +1,24 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; using System.Linq; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for healthchecks settings. + /// public class HealthChecksSettings { + /// + /// Gets or sets a value for the collection of healthchecks that are disabled. + /// public IEnumerable DisabledChecks { get; set; } = Enumerable.Empty(); + /// + /// Gets or sets a value for the healthcheck notification settings. + /// public HealthChecksNotificationSettings Notification { get; set; } = new HealthChecksNotificationSettings(); } } diff --git a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs index b003315c56..0478e9b7e1 100644 --- a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs @@ -1,18 +1,25 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for hosting settings. + /// public class HostingSettings { + /// + /// Gets or sets a value for the application virtual path. + /// public string ApplicationVirtualPath { get; set; } /// - /// Gets the configuration for the location of temporary files. + /// Gets or sets a value for the location of temporary files. /// public LocalTempStorage LocalTempStorageLocation { get; set; } = LocalTempStorage.Default; /// - /// Gets a value indicating whether umbraco is running in [debug mode]. + /// Gets or sets a value indicating whether umbraco is running in [debug mode]. /// /// true if [debug mode]; otherwise, false. public bool Debug { get; set; } = false; diff --git a/src/Umbraco.Core/Configuration/Models/ImagingAutoFillUploadField.cs b/src/Umbraco.Core/Configuration/Models/ImagingAutoFillUploadField.cs index f58e2bb4f8..999bcf2dff 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingAutoFillUploadField.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingAutoFillUploadField.cs @@ -1,22 +1,43 @@ -using System.ComponentModel.DataAnnotations; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.ComponentModel.DataAnnotations; using Umbraco.Core.Configuration.Models.Validation; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for image autofill upload settings. + /// public class ImagingAutoFillUploadField : ValidatableEntryBase { + /// + /// Gets or sets a value for the alias of the image upload property. + /// [Required] public string Alias { get; set; } + /// + /// Gets or sets a value for the width field alias of the image upload property. + /// [Required] public string WidthFieldAlias { get; set; } + /// + /// Gets or sets a value for the height field alias of the image upload property. + /// [Required] public string HeightFieldAlias { get; set; } + /// + /// Gets or sets a value for the length field alias of the image upload property. + /// [Required] public string LengthFieldAlias { get; set; } + /// + /// Gets or sets a value for the extension field alias of the image upload property. + /// [Required] public string ExtensionFieldAlias { get; set; } } diff --git a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs index 44f5ae89b6..0a3e723722 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs @@ -1,17 +1,34 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.IO; -using System.Threading; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for image cache settings. + /// public class ImagingCacheSettings { - public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.FromDays(7); + /// + /// Gets or sets a value for the browser image cache maximum age. + /// + public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.FromDays(7); + /// + /// Gets or sets a value for the image cache maximum age. + /// public TimeSpan CacheMaxAge { get; set; } = TimeSpan.FromDays(365); + /// + /// Gets or sets a value for length of the cached name. + /// public uint CachedNameLength { get; set; } = 8; + /// + /// Gets or sets a value for the cache folder. + /// public string CacheFolder { get; set; } = Path.Combine("..", "umbraco", "mediacache"); } } diff --git a/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs index f9db53d7dd..c95aad52ad 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs @@ -1,9 +1,21 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for image resize settings. + /// public class ImagingResizeSettings { + /// + /// Gets or sets a value for the maximim resize width. + /// public int MaxWidth { get; set; } = 5000; + /// + /// Gets or sets a value for the maximim resize height. + /// public int MaxHeight { get; set; } = 5000; } } diff --git a/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs index 2f253b151b..343e2a040f 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingSettings.cs @@ -1,9 +1,21 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for imaging settings. + /// public class ImagingSettings { + /// + /// Gets or sets a value for imaging cache settings. + /// public ImagingCacheSettings Cache { get; set; } = new ImagingCacheSettings(); + /// + /// Gets or sets a value for imaging resize settings. + /// public ImagingResizeSettings Resize { get; set; } = new ImagingResizeSettings(); } } diff --git a/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs index fcc22de9a3..9ea7348211 100644 --- a/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for index creator settings. + /// public class IndexCreatorSettings { + /// + /// Gets or sets a value for lucene directory factory type. + /// public string LuceneDirectoryFactory { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs index 2c53407398..57336d35ac 100644 --- a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs @@ -1,9 +1,21 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for keep alive settings. + /// public class KeepAliveSettings { + /// + /// Gets or sets a value indicating whether the keep alive task is disabled. + /// public bool DisableKeepAliveTask { get; set; } = false; + /// + /// Gets a value for the keep alive ping URL. + /// public string KeepAlivePingUrl => "{umbracoApplicationUrl}/api/keepalive/ping"; } } diff --git a/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs index 7d79bb83ae..49f2517f8f 100644 --- a/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs @@ -1,9 +1,18 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for logging settings. + /// public class LoggingSettings { + /// + /// Gets or sets a value for the maximum age of a log file. + /// public TimeSpan MaxLogAge { get; set; } = TimeSpan.FromHours(24); } } diff --git a/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs index 52bba6f4b8..abd12ae023 100644 --- a/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs @@ -1,19 +1,32 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for member password settings. + /// public class MemberPasswordConfigurationSettings : IPasswordConfiguration { + /// public int RequiredLength { get; set; } = 10; + /// public bool RequireNonLetterOrDigit { get; set; } = false; + /// public bool RequireDigit { get; set; } = false; + /// public bool RequireLowercase { get; set; } = false; + /// public bool RequireUppercase { get; set; } = false; + /// public string HashAlgorithmType { get; set; } = Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName; + /// public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5; } } diff --git a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs index f0b56561e2..bace0f96c4 100644 --- a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs @@ -1,17 +1,21 @@ -using Umbraco.Configuration; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Configuration; namespace Umbraco.Core.Configuration.Models { /// - /// Represents the models builder configuration. + /// Typed configuration options for models builder settings. /// public class ModelsBuilderSettings { - // TODO: This should not go into App_Data - that folder isn't really a real thing anymore - public static string DefaultModelsDirectory => "~/umbraco/models"; + private bool _flagOutOfDateModels; + + private static string DefaultModelsDirectory => "~/umbraco/models"; /// - /// Gets a value indicating whether the whole models experience is enabled. + /// Gets or sets a value indicating whether the whole models experience is enabled. /// /// /// If this is false then absolutely nothing happens. @@ -20,31 +24,29 @@ namespace Umbraco.Core.Configuration.Models public bool Enable { get; set; } = false; /// - /// Gets the models mode. + /// Gets or sets a value for the models mode. /// public ModelsMode ModelsMode { get; set; } = ModelsMode.Nothing; /// - /// Gets the models namespace. + /// Gets or sets a value for models namespace. /// /// That value could be overriden by other (attribute in user's code...). Return default if no value was supplied. public string ModelsNamespace { get; set; } /// - /// Gets a value indicating whether we should enable the models factory. + /// Gets or sets a value indicating whether we should enable the models factory. /// /// Default value is true because no factory is enabled by default in Umbraco. public bool EnableFactory { get; set; } = true; - private bool _flagOutOfDateModels; - /// - /// Gets a value indicating whether we should flag out-of-date models. + /// Gets or sets a value indicating whether we should flag out-of-date models. /// /// - /// Models become out-of-date when data types or content types are updated. When this - /// setting is activated the ~/App_Data/Models/ood.txt file is then created. When models are - /// generated through the dashboard, the files is cleared. Default value is false. + /// Models become out-of-date when data types or content types are updated. When this + /// setting is activated the ~/App_Data/Models/ood.txt file is then created. When models are + /// generated through the dashboard, the files is cleared. Default value is false. /// public bool FlagOutOfDateModels { @@ -62,22 +64,22 @@ namespace Umbraco.Core.Configuration.Models } /// - /// Gets the models directory. + /// Gets or sets a value for the models directory. /// /// Default is ~/App_Data/Models but that can be changed. public string ModelsDirectory { get; set; } = DefaultModelsDirectory; /// - /// Gets a value indicating whether to accept an unsafe value for ModelsDirectory. + /// Gets or sets a value indicating whether to accept an unsafe value for ModelsDirectory. /// /// - /// An unsafe value is an absolute path, or a relative path pointing outside - /// of the website root. + /// An unsafe value is an absolute path, or a relative path pointing outside + /// of the website root. /// public bool AcceptUnsafeModelsDirectory { get; set; } = false; /// - /// Gets a value indicating the debug log level. + /// Gets or sets a value indicating the debug log level. /// /// 0 means minimal (safe on live site), anything else means more and more details (maybe not safe). public int DebugLevel { get; set; } = 0; diff --git a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs index 89a726f30a..f98b1f422e 100644 --- a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { - public class NuCacheSettings + /// + /// Typed configuration options for NuCache settings. + /// + public class NuCacheSettings { + /// + /// Gets or sets a value defining the BTree block size. + /// public int? BTreeBlockSize { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs index d7203b4901..ceea0f9038 100644 --- a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs @@ -1,26 +1,32 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; using Umbraco.Core.Configuration.UmbracoSettings; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for request handler settings. + /// public class RequestHandlerSettings { internal static readonly CharItem[] DefaultCharCollection = { new CharItem { Char = " ", Replacement = "-" }, - new CharItem { Char = "\"", Replacement = "" }, - new CharItem { Char = "'", Replacement = "" }, - new CharItem { Char = "%", Replacement = "" }, - new CharItem { Char = ".", Replacement = "" }, - new CharItem { Char = ";", Replacement = "" }, - new CharItem { Char = "/", Replacement = "" }, - new CharItem { Char = "\\", Replacement = "" }, - new CharItem { Char = ":", Replacement = "" }, - new CharItem { Char = "#", Replacement = "" }, + new CharItem { Char = "\"", Replacement = string.Empty }, + new CharItem { Char = "'", Replacement = string.Empty }, + new CharItem { Char = "%", Replacement = string.Empty }, + new CharItem { Char = ".", Replacement = string.Empty }, + new CharItem { Char = ";", Replacement = string.Empty }, + new CharItem { Char = "/", Replacement = string.Empty }, + new CharItem { Char = "\\", Replacement = string.Empty }, + new CharItem { Char = ":", Replacement = string.Empty }, + new CharItem { Char = "#", Replacement = string.Empty }, new CharItem { Char = "+", Replacement = "plus" }, new CharItem { Char = "*", Replacement = "star" }, - new CharItem { Char = "&", Replacement = "" }, - new CharItem { Char = "?", Replacement = "" }, + new CharItem { Char = "&", Replacement = string.Empty }, + new CharItem { Char = "?", Replacement = string.Empty }, new CharItem { Char = "æ", Replacement = "ae" }, new CharItem { Char = "ä", Replacement = "ae" }, new CharItem { Char = "ø", Replacement = "oe" }, @@ -29,42 +35,63 @@ namespace Umbraco.Core.Configuration.Models new CharItem { Char = "ü", Replacement = "ue" }, new CharItem { Char = "ß", Replacement = "ss" }, new CharItem { Char = "|", Replacement = "-" }, - new CharItem { Char = "<", Replacement = "" }, - new CharItem { Char = ">", Replacement = "" } + new CharItem { Char = "<", Replacement = string.Empty }, + new CharItem { Char = ">", Replacement = string.Empty } }; + /// + /// Gets or sets a value indicating whether to add a trailing slash to URLs. + /// public bool AddTrailingSlash { get; set; } = true; + /// + /// Gets or sets a value indicating whether to convert URLs to ASCII (valid values: "true", "try" or "false"). + /// public string ConvertUrlsToAscii { get; set; } = "try"; + /// + /// Gets a value indicating whether URLs should be converted to ASCII. + /// public bool ShouldConvertUrlsToAscii => ConvertUrlsToAscii.InvariantEquals("true"); + /// + /// Gets a value indicating whether URLs should be tried to be converted to ASCII. + /// public bool ShouldTryConvertUrlsToAscii => ConvertUrlsToAscii.InvariantEquals("try"); - //We need to special handle ":", as this character is special in keys + // We need to special handle ":", as this character is special in keys // TODO: implement from configuration - //var collection = _configuration.GetSection(Prefix + "CharCollection").GetChildren() - // .Select(x => new CharItem() - // { - // Char = x.GetValue("Char"), - // Replacement = x.GetValue("Replacement"), - // }).ToArray(); + //// var collection = _configuration.GetSection(Prefix + "CharCollection").GetChildren() + //// .Select(x => new CharItem() + //// { + //// Char = x.GetValue("Char"), + //// Replacement = x.GetValue("Replacement"), + //// }).ToArray(); - //if (collection.Any() || _configuration.GetSection("Prefix").GetChildren().Any(x => - // x.Key.Equals("CharCollection", StringComparison.OrdinalIgnoreCase))) - //{ - // return collection; - //} + //// if (collection.Any() || _configuration.GetSection("Prefix").GetChildren().Any(x => + //// x.Key.Equals("CharCollection", StringComparison.OrdinalIgnoreCase))) + //// { + //// return collection; + //// } - // return DefaultCharCollection; + //// return DefaultCharCollection; + + /// + /// Gets or sets a value for the default character collection for replacements. + /// public IEnumerable CharCollection { get; set; } = DefaultCharCollection; + /// + /// Defines a character replacement. + /// public class CharItem : IChar { + /// public string Char { get; set; } + /// public string Replacement { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs b/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs index f93530b490..97af22ea8a 100644 --- a/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs @@ -1,9 +1,21 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for runtime settings. + /// public class RuntimeSettings { + /// + /// Gets or sets a value for the maximum query string length. + /// public int? MaxQueryStringLength { get; set; } + /// + /// Gets or sets a value for the maximum request length. + /// public int? MaxRequestLength { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs index 55bd3a5bf7..25bbbb645d 100644 --- a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs +++ b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs @@ -1,21 +1,51 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for security settings. + /// public class SecuritySettings { + /// + /// Gets or sets a value indicating whether to keep the user logged in. + /// public bool KeepUserLoggedIn { get; set; } = false; + /// + /// Gets or sets a value indicating whether to hide disabled users in the back-office. + /// public bool HideDisabledUsersInBackOffice { get; set; } = false; + /// + /// Gets or sets a value indicating whether to allow user password reset. + /// public bool AllowPasswordReset { get; set; } = true; + /// + /// Gets or sets a value for the authorization cookie name. + /// public string AuthCookieName { get; set; } = "UMB_UCONTEXT"; + /// + /// Gets or sets a value for the authorization cookie domain. + /// public string AuthCookieDomain { get; set; } + /// + /// Gets or sets a value indicating whether the user's email address is to be considered as their username. + /// public bool UsernameIsEmail { get; set; } = true; + /// + /// Gets or sets a value for the user password settings. + /// public UserPasswordConfigurationSettings UserPassword { get; set; } + /// + /// Gets or sets a value for the member password settings. + /// public MemberPasswordConfigurationSettings MemberPassword { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs index c1ba5edea2..fb4462f76d 100644 --- a/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs @@ -1,4 +1,7 @@ -using System.ComponentModel.DataAnnotations; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.ComponentModel.DataAnnotations; using System.Net.Mail; using Umbraco.Core.Configuration.Models.Validation; @@ -6,35 +9,82 @@ namespace Umbraco.Core.Configuration.Models { /// /// Matches MailKit.Security.SecureSocketOptions and defined locally to avoid having to take - /// thi + /// a dependency on this external library into Umbraco.Core. + /// See: http://www.mimekit.net/docs/html/T_MailKit_Security_SecureSocketOptions.htm /// public enum SecureSocketOptions { + /// + /// No SSL or TLS encryption should be used. + /// None = 0, + + /// + /// Allow the IMailService to decide which SSL or TLS options to use (default). If the server does not support SSL or TLS, then the connection will continue without any encryption. + /// Auto = 1, + + /// + /// The connection should use SSL or TLS encryption immediately. + /// SslOnConnect = 2, + + /// + /// Elevates the connection to use TLS encryption immediately after reading the greeting and capabilities of the server. If the server does not support the STARTTLS extension, then the connection will fail and a NotSupportedException will be thrown. + /// StartTls = 3, + + /// + /// Elevates the connection to use TLS encryption immediately after reading the greeting and capabilities of the server, but only if the server supports the STARTTLS extension. + /// StartTlsWhenAvailable = 4 } + /// + /// Typed configuration options for SMTP settings. + /// public class SmtpSettings : ValidatableEntryBase { + /// + /// Gets or sets a value for the SMTP from address to use for messages. + /// [Required] [EmailAddress] public string From { get; set; } + /// + /// Gets or sets a value for the SMTP host. + /// public string Host { get; set; } + /// + /// Gets or sets a value for the SMTP port. + /// public int Port { get; set; } + /// + /// Gets or sets a value for the secure socket options. + /// public SecureSocketOptions SecureSocketOptions { get; set; } = SecureSocketOptions.Auto; + /// + /// Gets or sets a value for the SMTP pick-up directory. + /// public string PickupDirectoryLocation { get; set; } + /// + /// Gets or sets a value for the SMTP delivery method. + /// public SmtpDeliveryMethod DeliveryMethod { get; set; } = SmtpDeliveryMethod.Network; + /// + /// Gets or sets a value for the SMTP user name. + /// public string Username { get; set; } + /// + /// Gets or sets a value for the SMTP password. + /// public string Password { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/TourSettings.cs b/src/Umbraco.Core/Configuration/Models/TourSettings.cs index 895eff6dee..25c06b9975 100644 --- a/src/Umbraco.Core/Configuration/Models/TourSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/TourSettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for tour settings. + /// public class TourSettings { + /// + /// Gets or sets a value indicating whether back-office tours are enabled. + /// public bool EnableTours { get; set; } = true; } } diff --git a/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs b/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs index c5210f6c8e..63295c7259 100644 --- a/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/TypeFinderSettings.cs @@ -1,7 +1,16 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for type finder settings. + /// public class TypeFinderSettings { + /// + /// Gets or sets a value for the assemblies that accept load exceptions during type finder operations. + /// public string AssembliesAcceptingLoadExceptions { get; set; } } } diff --git a/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs index 445a0f545c..09b9200760 100644 --- a/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs @@ -1,19 +1,32 @@ -namespace Umbraco.Core.Configuration.Models +// Copyright (c) Umbraco. +// See LICENSE for more details. + +namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for user password settings. + /// public class UserPasswordConfigurationSettings : IPasswordConfiguration { + /// public int RequiredLength { get; set; } = 10; + /// public bool RequireNonLetterOrDigit { get; set; } = false; + /// public bool RequireDigit { get; set; } = false; + /// public bool RequireLowercase { get; set; } = false; + /// public bool RequireUppercase { get; set; } = false; + /// public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName; + /// public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5; } } diff --git a/src/Umbraco.Core/Configuration/Models/Validation/ConfigurationValidatorBase.cs b/src/Umbraco.Core/Configuration/Models/Validation/ConfigurationValidatorBase.cs index 6c0af9802b..348c809a91 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/ConfigurationValidatorBase.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/ConfigurationValidatorBase.cs @@ -1,11 +1,24 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + using System.Collections.Generic; using System.Linq; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Base class for configuration validators. + /// public abstract class ConfigurationValidatorBase { + /// + /// Validates that a string is one of a set of valid values. + /// + /// Configuration path from where the setting is found. + /// The value to check. + /// The set of valid values. + /// A message to output if the value does not match. + /// True if valid, false if not. public bool ValidateStringIsOneOfValidValues(string configPath, string value, IEnumerable validValues, out string message) { if (!validValues.InvariantContains(value)) @@ -18,6 +31,14 @@ namespace Umbraco.Core.Configuration.Models.Validation return true; } + /// + /// Validates that a collection of objects are all valid based on their data annotations. + /// + /// Configuration path from where the setting is found. + /// The values to check. + /// Description of validation appended to message if validation fails. + /// A message to output if the value does not match. + /// True if valid, false if not. public bool ValidateCollection(string configPath, IEnumerable values, string validationDescription, out string message) { if (values.Any(x => !x.IsValid())) @@ -30,6 +51,14 @@ namespace Umbraco.Core.Configuration.Models.Validation return true; } + /// + /// Validates a configuration entry is valid if provided. + /// + /// Configuration path from where the setting is found. + /// The value to check. + /// Description of validation appended to message if validation fails. + /// A message to output if the value does not match. + /// True if valid, false if not. public bool ValidateOptionalEntry(string configPath, ValidatableEntryBase value, string validationDescription, out string message) { if (value != null && !value.IsValid()) @@ -41,8 +70,5 @@ namespace Umbraco.Core.Configuration.Models.Validation message = string.Empty; return true; } - - - } } diff --git a/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs index f6e839aa39..fdfd6de59c 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs @@ -1,14 +1,20 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; using Microsoft.Extensions.Options; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Validator for configuration representated as . + /// public class ContentSettingsValidator : ConfigurationValidatorBase, IValidateOptions { + /// public ValidateOptionsResult Validate(string name, ContentSettings options) { - string message; - if (!ValidateError404Collection(options.Error404Collection, out message)) + if (!ValidateError404Collection(options.Error404Collection, out string message)) { return ValidateOptionsResult.Fail(message); } @@ -21,14 +27,10 @@ namespace Umbraco.Core.Configuration.Models.Validation return ValidateOptionsResult.Success; } - private bool ValidateError404Collection(IEnumerable values, out string message) - { - return ValidateCollection($"{Constants.Configuration.ConfigContent}:{nameof(ContentSettings.Error404Collection)}", values, "Culture and one and only one of ContentId, ContentKey and ContentXPath must be specified for each entry", out message); - } + private bool ValidateError404Collection(IEnumerable values, out string message) => + ValidateCollection($"{Constants.Configuration.ConfigContent}:{nameof(ContentSettings.Error404Collection)}", values, "Culture and one and only one of ContentId, ContentKey and ContentXPath must be specified for each entry", out message); - private bool ValidateAutoFillImageProperties(IEnumerable values, out string message) - { - return ValidateCollection($"{Constants.Configuration.ConfigContent}:{nameof(ContentSettings.Imaging)}:{nameof(ContentSettings.Imaging.AutoFillImageProperties)}", values, "Alias, WidthFieldAlias, HeightFieldAlias, LengthFieldAlias and ExtensionFieldAlias must be specified for each entry", out message); - } + private bool ValidateAutoFillImageProperties(IEnumerable values, out string message) => + ValidateCollection($"{Constants.Configuration.ConfigContent}:{nameof(ContentSettings.Imaging)}:{nameof(ContentSettings.Imaging.AutoFillImageProperties)}", values, "Alias, WidthFieldAlias, HeightFieldAlias, LengthFieldAlias and ExtensionFieldAlias must be specified for each entry", out message); } } diff --git a/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs index ca3fee7999..6bc9dc0a6f 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs @@ -1,10 +1,17 @@ -using Microsoft.Extensions.Options; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Validator for configuration representated as . + /// public class GlobalSettingsValidator : ConfigurationValidatorBase, IValidateOptions { + /// public ValidateOptionsResult Validate(string name, GlobalSettings options) { if (!ValidateSmtpSetting(options.Smtp, out var message)) @@ -15,9 +22,7 @@ namespace Umbraco.Core.Configuration.Models.Validation return ValidateOptionsResult.Success; } - private bool ValidateSmtpSetting(SmtpSettings value, out string message) - { - return ValidateOptionalEntry($"{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.Smtp)}", value, "A valid From email address is required", out message); - } + private bool ValidateSmtpSetting(SmtpSettings value, out string message) => + ValidateOptionalEntry($"{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.Smtp)}", value, "A valid From email address is required", out message); } } diff --git a/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs index f26fce9bd9..449415c37f 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs @@ -1,16 +1,24 @@ -using Microsoft.Extensions.Options; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Validator for configuration representated as . + /// public class HealthChecksSettingsValidator : ConfigurationValidatorBase, IValidateOptions { private readonly ICronTabParser _cronTabParser; - public HealthChecksSettingsValidator(ICronTabParser cronTabParser) - { - _cronTabParser = cronTabParser; - } + /// + /// Initializes a new instance of the class. + /// + /// Helper for parsing crontab expressions. + public HealthChecksSettingsValidator(ICronTabParser cronTabParser) => _cronTabParser = cronTabParser; + /// public ValidateOptionsResult Validate(string name, HealthChecksSettings options) { if (!ValidateNotificationFirstRunTime(options.Notification.FirstRunTime, out var message)) @@ -21,12 +29,10 @@ namespace Umbraco.Core.Configuration.Models.Validation return ValidateOptionsResult.Success; } - private bool ValidateNotificationFirstRunTime(string value, out string message) - { - return ValidateOptionalCronTab($"{Constants.Configuration.ConfigHealthChecks}:{nameof(HealthChecksSettings.Notification)}:{nameof(HealthChecksSettings.Notification.FirstRunTime)}", value, out message); - } + private bool ValidateNotificationFirstRunTime(string value, out string message) => + ValidateOptionalCronTab($"{Constants.Configuration.ConfigHealthChecks}:{nameof(HealthChecksSettings.Notification)}:{nameof(HealthChecksSettings.Notification.FirstRunTime)}", value, out message); - public bool ValidateOptionalCronTab(string configPath, string value, out string message) + private bool ValidateOptionalCronTab(string configPath, string value, out string message) { if (!string.IsNullOrEmpty(value) && !_cronTabParser.IsValidCronTab(value)) { diff --git a/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs index 305fe812f8..647c7438c6 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs @@ -1,9 +1,16 @@ -using Microsoft.Extensions.Options; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Validator for configuration representated as . + /// public class RequestHandlerSettingsValidator : ConfigurationValidatorBase, IValidateOptions { + /// public ValidateOptionsResult Validate(string name, RequestHandlerSettings options) { if (!ValidateConvertUrlsToAscii(options.ConvertUrlsToAscii, out var message)) diff --git a/src/Umbraco.Core/Configuration/Models/Validation/ValidatableEntryBase.cs b/src/Umbraco.Core/Configuration/Models/Validation/ValidatableEntryBase.cs index 32e3c3270b..37380eb9a6 100644 --- a/src/Umbraco.Core/Configuration/Models/Validation/ValidatableEntryBase.cs +++ b/src/Umbraco.Core/Configuration/Models/Validation/ValidatableEntryBase.cs @@ -1,8 +1,14 @@ -using System.Collections.Generic; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Umbraco.Core.Configuration.Models.Validation { + /// + /// Provides a base class for configuration models that can be validated based on data annotations. + /// public abstract class ValidatableEntryBase { internal virtual bool IsValid() diff --git a/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs index 476d58c913..9f06046452 100644 --- a/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs @@ -1,23 +1,53 @@ -using Umbraco.Core.Models.PublishedContent; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Core.Models.PublishedContent; namespace Umbraco.Core.Configuration.Models { + /// + /// Typed configuration options for web routing settings. + /// public class WebRoutingSettings { + /// + /// Gets or sets a value indicating whether IIS custom errors should be skipped. + /// public bool TrySkipIisCustomErrors { get; set; } = false; + /// + /// Gets or sets a value indicating whether an internal redirect should preserve the template. + /// public bool InternalRedirectPreservesTemplate { get; set; } = false; + /// + /// Gets or sets a value indicating whether the use of alternative templates are disabled. + /// public bool DisableAlternativeTemplates { get; set; } = false; + /// + /// Gets or sets a value indicating whether the use of alternative templates should be validated. + /// public bool ValidateAlternativeTemplates { get; set; } = false; + /// + /// Gets or sets a value indicating whether find content ID by path is disabled. + /// public bool DisableFindContentByIdPath { get; set; } = false; + /// + /// Gets or sets a value indicating whether redirect URL tracking is disabled. + /// public bool DisableRedirectUrlTracking { get; set; } = false; + /// + /// Gets or sets a value for the URL provider mode (). + /// public UrlMode UrlProviderMode { get; set; } = UrlMode.Auto; + /// + /// Gets or sets a value for the Umbraco application URL. + /// public string UmbracoApplicationUrl { get; set; } } } diff --git a/src/Umbraco.Infrastructure/Scoping/Scope.cs b/src/Umbraco.Infrastructure/Scoping/Scope.cs index 87986a6318..65e8e343f7 100644 --- a/src/Umbraco.Infrastructure/Scoping/Scope.cs +++ b/src/Umbraco.Infrastructure/Scoping/Scope.cs @@ -496,7 +496,7 @@ namespace Umbraco.Core.Scoping // caching config // true if Umbraco.CoreDebugSettings.LogUncompletedScope appSetting is set to "true" private bool LogUncompletedScopes => (_logUncompletedScopes - ?? (_logUncompletedScopes = _coreDebugSettings.LogUncompletedScopes)).Value; + ?? (_logUncompletedScopes = _coreDebugSettings.LogIncompletedScopes)).Value; /// public void ReadLock(params int[] lockIds) => Database.SqlContext.SqlSyntax.ReadLock(Database, lockIds); diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidatorTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidatorTests.cs index 3cc0532db2..f286dd42b0 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidatorTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidatorTests.cs @@ -1,4 +1,8 @@ -using NUnit.Framework; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; +using NUnit.Framework; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Configuration.Models.Validation; @@ -11,8 +15,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Success_ForValid_Configuration() { var validator = new GlobalSettingsValidator(); - var options = BuildGlobalSettings(); - var result = validator.Validate("settings", options); + GlobalSettings options = BuildGlobalSettings(); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.True(result.Succeeded); } @@ -20,20 +24,18 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Fail_For_Configuration_With_Invalid_SmtpFrom_Field() { var validator = new GlobalSettingsValidator(); - var options = BuildGlobalSettings(smtpEmail: "invalid"); - var result = validator.Validate("settings", options); + GlobalSettings options = BuildGlobalSettings(smtpEmail: "invalid"); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } - private static GlobalSettings BuildGlobalSettings(string smtpEmail = "test@test.com") - { - return new GlobalSettings + private static GlobalSettings BuildGlobalSettings(string smtpEmail = "test@test.com") => + new GlobalSettings { Smtp = new SmtpSettings { From = smtpEmail, } }; - } } } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidatorTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidatorTests.cs index 64a8be79a8..9ae5444134 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidatorTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidatorTests.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; +using Microsoft.Extensions.Options; using NUnit.Framework; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Models; @@ -13,8 +17,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Success_ForValid_Configuration() { var validator = new HealthChecksSettingsValidator(new NCronTabParser()); - var options = BuildHealthChecksSettings(); - var result = validator.Validate("settings", options); + HealthChecksSettings options = BuildHealthChecksSettings(); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.True(result.Succeeded); } @@ -22,14 +26,13 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Fail_For_Configuration_With_Invalid_Notification_FirstRunTime() { var validator = new HealthChecksSettingsValidator(new NCronTabParser()); - var options = BuildHealthChecksSettings(firstRunTime: "0 3 *"); - var result = validator.Validate("settings", options); + HealthChecksSettings options = BuildHealthChecksSettings(firstRunTime: "0 3 *"); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } - private static HealthChecksSettings BuildHealthChecksSettings(string firstRunTime = "0 3 * * *") - { - return new HealthChecksSettings + private static HealthChecksSettings BuildHealthChecksSettings(string firstRunTime = "0 3 * * *") => + new HealthChecksSettings { Notification = new HealthChecksNotificationSettings { @@ -38,6 +41,5 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation Period = TimeSpan.FromHours(1), } }; - } } } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidatorTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidatorTests.cs index f579fec695..4a53fbf375 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidatorTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidatorTests.cs @@ -1,4 +1,8 @@ -using NUnit.Framework; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; +using NUnit.Framework; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Configuration.Models.Validation; @@ -12,7 +16,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation { var validator = new RequestHandlerSettingsValidator(); var options = new RequestHandlerSettings(); - var result = validator.Validate("settings", options); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.True(result.Succeeded); } @@ -21,7 +25,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation { var validator = new RequestHandlerSettingsValidator(); var options = new RequestHandlerSettings { ConvertUrlsToAscii = "invalid" }; - var result = validator.Validate("settings", options); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } }