Updates to Core.Configuration Models to use DefaultValue attribute to allow auto generated JSONSchema to give a default value in schema

This commit is contained in:
Warren Buckley
2021-07-05 14:27:49 +01:00
parent cd36d050c5
commit 6b73ea767f
28 changed files with 372 additions and 106 deletions

View File

@@ -1,6 +1,9 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -20,10 +23,13 @@ namespace Umbraco.Cms.Core.Configuration.Models
}
};
internal const string StaticImageFileTypes = "jpeg,jpg,gif,bmp,png,tiff,tif";
/// <summary>
/// Gets or sets a value for the collection of accepted image file extensions.
/// </summary>
public string[] ImageFileTypes { get; set; } = new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" };
[DefaultValue(StaticImageFileTypes)]
public string[] ImageFileTypes { get; set; } = StaticImageFileTypes.Split(',');
/// <summary>
/// Gets or sets a value for the imaging autofill following media file upload fields.

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -8,6 +10,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class ContentNotificationSettings
{
internal const bool StaticDisableHtmlEmail = false;
/// <summary>
/// Gets or sets a value for the email address for notifications.
/// </summary>
@@ -16,6 +20,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value indicating whether HTML email notifications should be disabled.
/// </summary>
public bool DisableHtmlEmail { get; set; } = false;
[DefaultValue(StaticDisableHtmlEmail)]
public bool DisableHtmlEmail { get; set; } = StaticDisableHtmlEmail;
}
}

View File

@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Macros;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -13,7 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigContent)]
public class ContentSettings
{
private const string DefaultPreviewBadge =
internal const bool StaticResolveUrlsFromTextString = false;
internal const string StaticDefaultPreviewBadge =
@"
<div id=""umbracoPreviewBadge"" class=""umbraco-preview-badge"">
<span class=""umbraco-preview-badge__header"">Preview mode</span>
@@ -148,6 +151,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
</style>
<script type=""text/javascript"" data-umbraco-path=""{0}"" src=""{0}/js/umbraco.websitepreview.min.js""></script>";
internal const string StaticMacroErrors = "Inline";
internal const string StaticDisallowedUploadFiles = "ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,xamlx";
internal const bool StaticShowDeprecatedPropertyEditors = false;
internal const string StaticLoginBackgroundImage = "assets/img/login.jpg";
internal const string StaticLoginLogoImage = "assets/img/application/umbraco_logo_white.svg";
/// <summary>
/// Gets or sets a value for the content notification settings.
/// </summary>
@@ -161,7 +170,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value indicating whether URLs should be resolved from text strings.
/// </summary>
public bool ResolveUrlsFromTextString { get; set; } = false;
[DefaultValue(StaticResolveUrlsFromTextString)]
public bool ResolveUrlsFromTextString { get; set; } = StaticResolveUrlsFromTextString;
/// <summary>
/// Gets or sets a value for the collection of error pages.
@@ -171,17 +181,20 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the preview badge mark-up.
/// </summary>
public string PreviewBadge { get; set; } = DefaultPreviewBadge;
[DefaultValue(StaticDefaultPreviewBadge)]
public string PreviewBadge { get; set; } = StaticDefaultPreviewBadge;
/// <summary>
/// Gets or sets a value for the macro error behaviour.
/// </summary>
public MacroErrorBehaviour MacroErrors { get; set; } = MacroErrorBehaviour.Inline;
[DefaultValue(StaticMacroErrors)]
public MacroErrorBehaviour MacroErrors { get; set; } = Enum<MacroErrorBehaviour>.Parse(StaticMacroErrors);
/// <summary>
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
/// </summary>
public IEnumerable<string> DisallowedUploadFiles { get; set; } = new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd", "xamlx" };
[DefaultValue(StaticDisallowedUploadFiles)]
public IEnumerable<string> DisallowedUploadFiles { get; set; } = StaticDisallowedUploadFiles.Split(',');
/// <summary>
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
@@ -191,17 +204,20 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value indicating whether deprecated property editors should be shown.
/// </summary>
public bool ShowDeprecatedPropertyEditors { get; set; } = false;
[DefaultValue(StaticShowDeprecatedPropertyEditors)]
public bool ShowDeprecatedPropertyEditors { get; set; } = StaticShowDeprecatedPropertyEditors;
/// <summary>
/// Gets or sets a value for the path to the login screen background image.
/// </summary>
public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg";
[DefaultValue(StaticLoginBackgroundImage)]
public string LoginBackgroundImage { get; set; } = StaticLoginBackgroundImage;
/// <summary>
/// Gets or sets a value for the path to the login screen logo image.
/// </summary>
public string LoginLogoImage { get; set; } = "assets/img/application/umbraco_logo_white.svg";
[DefaultValue(StaticLoginLogoImage)]
public string LoginLogoImage { get; set; } = StaticLoginLogoImage;
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigCoreDebug)]
public class CoreDebugSettings
{
internal const bool StaticLogIncompletedScopes = false;
internal const bool StaticDumpOnTimeoutThreadAbort = false;
/// <summary>
/// Gets or sets a value indicating whether incompleted scopes should be logged.
/// </summary>
public bool LogIncompletedScopes { get; set; } = false;
[DefaultValue(StaticLogIncompletedScopes)]
public bool LogIncompletedScopes { get; set; } = StaticLogIncompletedScopes;
/// <summary>
/// Gets or sets a value indicating whether memory dumps on thread abort should be taken.
/// </summary>
public bool DumpOnTimeoutThreadAbort { get; set; } = false;
[DefaultValue(StaticDumpOnTimeoutThreadAbort)]
public bool DumpOnTimeoutThreadAbort { get; set; } = StaticDumpOnTimeoutThreadAbort;
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -10,24 +11,33 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class DatabaseServerMessengerSettings
{
internal const int StaticMaxProcessingInstructionCount = 1000;
internal const string StaticTimeToRetainInstructions = "2.00:00:00"; // TimeSpan.FromDays(2);
internal const string StaticTimeBetweenSyncOperations = "00:00:05"; // TimeSpan.FromSeconds(5);
internal const string StaticTimeBetweenPruneOperations = "00:01:00"; // TimeSpan.FromMinutes(1);
/// <summary>
/// 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).
/// </summary>
public int MaxProcessingInstructionCount { get; set; } = 1000;
[DefaultValue(StaticMaxProcessingInstructionCount)]
public int MaxProcessingInstructionCount { get; set; } = StaticMaxProcessingInstructionCount;
/// <summary>
/// Gets or sets a value for the time to keep instructions in the database; records older than this number will be pruned.
/// </summary>
public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.FromDays(2);
[DefaultValue(StaticTimeToRetainInstructions)]
public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.Parse(StaticTimeToRetainInstructions);
/// <summary>
/// Gets or sets a value for the time to wait between each sync operations.
/// </summary>
public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.FromSeconds(5);
[DefaultValue(StaticTimeBetweenSyncOperations)]
public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.Parse(StaticTimeBetweenSyncOperations);
/// <summary>
/// Gets or sets a value for the time to wait between each prune operations.
/// </summary>
public TimeSpan TimeBetweenPruneOperations { get; set; } = TimeSpan.FromMinutes(1);
[DefaultValue(StaticTimeBetweenPruneOperations)]
public TimeSpan TimeBetweenPruneOperations { get; set; } = TimeSpan.Parse(StaticTimeBetweenPruneOperations);
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -10,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class DatabaseServerRegistrarSettings
{
internal const string StaticWaitTimeBetweenCalls = "00:01:00";
internal const string StaticStaleServerTimeout = "00:02:00";
/// <summary>
/// Gets or sets a value for the amount of time to wait between calls to the database on the background thread.
/// </summary>
public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.FromMinutes(1);
[DefaultValue(StaticWaitTimeBetweenCalls)]
public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.Parse(StaticWaitTimeBetweenCalls);
/// <summary>
/// Gets or sets a value for the time span to wait before considering a server stale, after it has last been accessed.
/// </summary>
public TimeSpan StaleServerTimeout { get; set; } = TimeSpan.FromMinutes(2);
[DefaultValue(StaticStaleServerTimeout)]
public TimeSpan StaleServerTimeout { get; set; } = TimeSpan.Parse(StaticStaleServerTimeout);
}
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigExceptionFilter)]
public class ExceptionFilterSettings
{
internal const bool StaticDisabled = false;
/// <summary>
/// Gets or sets a value indicating whether the exception filter is disabled.
/// </summary>
public bool Disabled { get; set; } = false;
[DefaultValue(StaticDisabled)]
public bool Disabled { get; set; } = StaticDisabled;
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -11,51 +12,72 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigGlobal)]
public class GlobalSettings
{
internal const string
StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; // must end with a comma!
internal const string
StaticReservedUrls = "~/.well-known,"; // must end with a comma!
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; // must end with a comma!
internal const string StaticReservedUrls = "~/.well-known,"; // must end with a comma!
internal const string StaticTimeOut = "00:20:00";
internal const string StaticDefaultUILanguage = "en-US";
internal const bool StaticHideTopLevelNodeFromPath = true;
internal const bool StaticUseHttps = false;
internal const int StaticVersionCheckPeriod = 7;
internal const string StaticUmbracoPath = "~/umbraco";
internal const string StaticIconsPath = "~/umbraco/assets/icons";
internal const string StaticUmbracoCssPath = "~/css";
internal const string StaticUmbracoScriptsPath = "~/scripts";
internal const string StaticUmbracoMediaPath = "~/media";
internal const bool StaticInstallMissingDatabase = false;
internal const bool StaticDisableElectionForSingleServer = false;
internal const string StaticNoNodesViewPath = "~/umbraco/UmbracoWebsite/NoNodes.cshtml";
internal const string StaticSqlWriteLockTimeOut = "00:00:05";
/// <summary>
/// Gets or sets a value for the reserved URLs.
/// It must end with a comma
/// </summary>
[DefaultValue(StaticReservedUrls)]
public string ReservedUrls { get; set; } = StaticReservedUrls;
/// <summary>
/// Gets or sets a value for the reserved paths.
/// It must end with a comma
/// </summary>
[DefaultValue(StaticReservedPaths)]
public string ReservedPaths { get; set; } = StaticReservedPaths;
/// <summary>
/// Gets or sets a value for the timeout
/// </summary>
public TimeSpan TimeOut{ get; set; } = TimeSpan.FromMinutes(20);
[DefaultValue(StaticTimeOut)]
public TimeSpan TimeOut { get; set; } = TimeSpan.Parse(StaticTimeOut);
/// <summary>
/// Gets or sets a value for the default UI language.
/// </summary>
public string DefaultUILanguage { get; set; } = "en-US";
[DefaultValue(StaticDefaultUILanguage)]
public string DefaultUILanguage { get; set; } = StaticDefaultUILanguage;
/// <summary>
/// Gets or sets a value indicating whether to hide the top level node from the path.
/// </summary>
public bool HideTopLevelNodeFromPath { get; set; } = true;
[DefaultValue(StaticHideTopLevelNodeFromPath)]
public bool HideTopLevelNodeFromPath { get; set; } = StaticHideTopLevelNodeFromPath;
/// <summary>
/// Gets or sets a value indicating whether HTTPS should be used.
/// </summary>
public bool UseHttps { get; set; } = false;
[DefaultValue(StaticUseHttps)]
public bool UseHttps { get; set; } = StaticUseHttps;
/// <summary>
/// Gets or sets a value for the version check period in days.
/// </summary>
public int VersionCheckPeriod { get; set; } = 7;
[DefaultValue(StaticVersionCheckPeriod)]
public int VersionCheckPeriod { get; set; } = StaticVersionCheckPeriod;
/// <summary>
/// Gets or sets a value for the Umbraco back-office path.
/// </summary>
public string UmbracoPath { get; set; } = "~/umbraco";
[DefaultValue(StaticUmbracoPath)]
public string UmbracoPath { get; set; } = StaticUmbracoPath;
/// <summary>
/// Gets or sets a value for the Umbraco icons path.
@@ -65,32 +87,38 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// 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.
/// </remarks>
public string IconsPath { get; set; } = $"~/umbraco/assets/icons";
[DefaultValue(StaticIconsPath)]
public string IconsPath { get; set; } = StaticIconsPath;
/// <summary>
/// Gets or sets a value for the Umbraco CSS path.
/// </summary>
public string UmbracoCssPath { get; set; } = "~/css";
[DefaultValue(StaticUmbracoCssPath)]
public string UmbracoCssPath { get; set; } = StaticUmbracoCssPath;
/// <summary>
/// Gets or sets a value for the Umbraco scripts path.
/// </summary>
public string UmbracoScriptsPath { get; set; } = "~/scripts";
[DefaultValue(StaticUmbracoScriptsPath)]
public string UmbracoScriptsPath { get; set; } = StaticUmbracoScriptsPath;
/// <summary>
/// Gets or sets a value for the Umbraco media path.
/// </summary>
public string UmbracoMediaPath { get; set; } = "~/media";
[DefaultValue(StaticUmbracoMediaPath)]
public string UmbracoMediaPath { get; set; } = StaticUmbracoMediaPath;
/// <summary>
/// Gets or sets a value indicating whether to install the database when it is missing.
/// </summary>
public bool InstallMissingDatabase { get; set; } = false;
[DefaultValue(StaticInstallMissingDatabase)]
public bool InstallMissingDatabase { get; set; } = StaticInstallMissingDatabase;
/// <summary>
/// Gets or sets a value indicating whether to disable the election for a single server.
/// </summary>
public bool DisableElectionForSingleServer { get; set; } = false;
[DefaultValue(StaticDisableElectionForSingleServer)]
public bool DisableElectionForSingleServer { get; set; } = StaticDisableElectionForSingleServer;
/// <summary>
/// Gets or sets a value for the database factory server version.
@@ -106,7 +134,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the path to the no content view.
/// </summary>
public string NoNodesViewPath { get; set; } = "~/umbraco/UmbracoWebsite/NoNodes.cshtml";
[DefaultValue(StaticNoNodesViewPath)]
public string NoNodesViewPath { get; set; } = StaticNoNodesViewPath;
/// <summary>
/// Gets or sets a value for the database server registrar settings.
@@ -135,6 +164,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// The default value is 5000 milliseconds
/// </remarks>
/// <value>The timeout in milliseconds.</value>
public TimeSpan SqlWriteLockTimeOut { get; } = TimeSpan.FromMilliseconds(5000);
[DefaultValue(StaticSqlWriteLockTimeOut)]
public TimeSpan SqlWriteLockTimeOut { get; } = TimeSpan.Parse(StaticSqlWriteLockTimeOut);
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.HealthChecks;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,20 +12,27 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class HealthChecksNotificationMethodSettings
{
internal const bool StaticEnabled = false;
internal const string StaticVerbosity = "Summary"; // Enum
internal const bool StaticFailureOnly = false;
/// <summary>
/// Gets or sets a value indicating whether the health check notification method is enabled.
/// </summary>
public bool Enabled { get; set; } = false;
[DefaultValue(StaticEnabled)]
public bool Enabled { get; set; } = StaticEnabled;
/// <summary>
/// Gets or sets a value for the health check notifications reporting verbosity.
/// </summary>
public HealthCheckNotificationVerbosity Verbosity { get; set; } = HealthCheckNotificationVerbosity.Summary;
[DefaultValue(StaticVerbosity)]
public HealthCheckNotificationVerbosity Verbosity { get; set; } = Enum<HealthCheckNotificationVerbosity>.Parse(StaticVerbosity);
/// <summary>
/// Gets or sets a value indicating whether the health check notifications should occur on failures only.
/// </summary>
public bool FailureOnly { get; set; } = false;
[DefaultValue(StaticFailureOnly)]
public bool FailureOnly { get; set; } = StaticFailureOnly;
/// <summary>
/// Gets or sets a value providing provider specific settings for the health check notification method.

View File

@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -12,10 +13,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class HealthChecksNotificationSettings
{
internal const bool StaticEnabled = false;
internal const string StaticPeriod = "1.00:00:00"; //TimeSpan.FromHours(24);
/// <summary>
/// Gets or sets a value indicating whether health check notifications are enabled.
/// </summary>
public bool Enabled { get; set; } = false;
[DefaultValue(StaticEnabled)]
public bool Enabled { get; set; } = StaticEnabled;
/// <summary>
/// Gets or sets a value for the first run time of a healthcheck notification in crontab format.
@@ -25,7 +30,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the period of the healthcheck notification.
/// </summary>
public TimeSpan Period { get; set; } = TimeSpan.FromHours(24);
[DefaultValue(StaticPeriod)]
public TimeSpan Period { get; set; } = TimeSpan.Parse(StaticPeriod);
/// <summary>
/// Gets or sets a value for the collection of health check notification methods.

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigHosting)]
public class HostingSettings
{
internal const string StaticLocalTempStorageLocation = "Default";
internal const bool StaticDebug = false;
/// <summary>
/// Gets or sets a value for the application virtual path.
/// </summary>
@@ -17,12 +22,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the location of temporary files.
/// </summary>
public LocalTempStorage LocalTempStorageLocation { get; set; } = LocalTempStorage.Default;
[DefaultValue(StaticLocalTempStorageLocation)]
public LocalTempStorage LocalTempStorageLocation { get; set; } = Enum<LocalTempStorage>.Parse(StaticLocalTempStorageLocation);
/// <summary>
/// Gets or sets a value indicating whether umbraco is running in [debug mode].
/// </summary>
/// <value><c>true</c> if [debug mode]; otherwise, <c>false</c>.</value>
public bool Debug { get; set; } = false;
[DefaultValue(StaticDebug)]
public bool Debug { get; set; } = StaticDebug;
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System;
using System.ComponentModel;
using System.IO;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,24 +12,33 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class ImagingCacheSettings
{
internal const string StaticBrowserMaxAge = "7.00:00:00"; // TimeSpan.FromDays(7);
internal const string StaticCacheMaxAge = "365.00:00:00"; // TimeSpan.FromDays(365);
internal const int StaticCachedNameLength = 8;
internal const string StaticCacheFolder = "../umbraco/mediacache";
/// <summary>
/// Gets or sets a value for the browser image cache maximum age.
/// </summary>
public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.FromDays(7);
[DefaultValue(StaticBrowserMaxAge)]
public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.Parse(StaticBrowserMaxAge);
/// <summary>
/// Gets or sets a value for the image cache maximum age.
/// </summary>
public TimeSpan CacheMaxAge { get; set; } = TimeSpan.FromDays(365);
[DefaultValue(StaticCacheMaxAge)]
public TimeSpan CacheMaxAge { get; set; } = TimeSpan.Parse(StaticCacheMaxAge);
/// <summary>
/// Gets or sets a value for length of the cached name.
/// </summary>
public uint CachedNameLength { get; set; } = 8;
[DefaultValue(StaticCachedNameLength)]
public uint CachedNameLength { get; set; } = StaticCachedNameLength;
/// <summary>
/// Gets or sets a value for the cache folder.
/// </summary>
public string CacheFolder { get; set; } = Path.Combine("..", "umbraco", "mediacache");
[DefaultValue(StaticCacheFolder)]
public string CacheFolder { get; set; } = StaticCacheFolder;
}
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -8,14 +10,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class ImagingResizeSettings
{
internal const int StaticMaxWidth = 5000;
internal const int StaticMaxHeight = 5000;
/// <summary>
/// Gets or sets a value for the maximim resize width.
/// </summary>
public int MaxWidth { get; set; } = 5000;
[DefaultValue(StaticMaxWidth)]
public int MaxWidth { get; set; } = StaticMaxWidth;
/// <summary>
/// Gets or sets a value for the maximim resize height.
/// </summary>
public int MaxHeight { get; set; } = 5000;
[DefaultValue(StaticMaxHeight)]
public int MaxHeight { get; set; } = StaticMaxHeight;
}
}

View File

@@ -1,8 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using Umbraco.Cms.Core.Hosting;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -12,10 +11,13 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigKeepAlive)]
public class KeepAliveSettings
{
internal const bool StaticDisableKeepAliveTask = false;
/// <summary>
/// Gets or sets a value indicating whether the keep alive task is disabled.
/// </summary>
public bool DisableKeepAliveTask { get; set; } = false;
[DefaultValue(StaticDisableKeepAliveTask)]
public bool DisableKeepAliveTask { get; set; } = StaticDisableKeepAliveTask;
/// <summary>
/// Gets a value for the keep alive ping URL.

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -11,9 +12,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigLogging)]
public class LoggingSettings
{
internal const string StaticMaxLogAge = "1.00:00:00"; // TimeSpan.FromHours(24);
/// <summary>
/// Gets or sets a value for the maximum age of a log file.
/// </summary>
public TimeSpan MaxLogAge { get; set; } = TimeSpan.FromHours(24);
[DefaultValue(StaticMaxLogAge)]
public TimeSpan MaxLogAge { get; set; } = TimeSpan.Parse(StaticMaxLogAge);
}
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,25 +11,39 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigMemberPassword)]
public class MemberPasswordConfigurationSettings : IPasswordConfiguration
{
/// <inheritdoc/>
public int RequiredLength { get; set; } = 10;
internal const int StaticRequiredLength = 10;
internal const bool StaticRequireNonLetterOrDigit = false;
internal const bool StaticRequireDigit = false;
internal const bool StaticRequireLowercase = false;
internal const bool StaticRequireUppercase = false;
internal const int StaticMaxFailedAccessAttemptsBeforeLockout = 5;
/// <inheritdoc/>
public bool RequireNonLetterOrDigit { get; set; } = false;
[DefaultValue(StaticRequiredLength)]
public int RequiredLength { get; set; } = StaticRequiredLength;
/// <inheritdoc/>
public bool RequireDigit { get; set; } = false;
[DefaultValue(StaticRequireNonLetterOrDigit)]
public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit;
/// <inheritdoc/>
public bool RequireLowercase { get; set; } = false;
[DefaultValue(StaticRequireDigit)]
public bool RequireDigit { get; set; } = StaticRequireDigit;
/// <inheritdoc/>
public bool RequireUppercase { get; set; } = false;
[DefaultValue(StaticRequireLowercase)]
public bool RequireLowercase { get; set; } = StaticRequireLowercase;
/// <inheritdoc/>
[DefaultValue(StaticRequireUppercase)]
public bool RequireUppercase { get; set; } = StaticRequireUppercase;
/// <inheritdoc/>
[DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)]
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName;
/// <inheritdoc/>
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5;
[DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)]
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout;
}
}

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Extensions;
@@ -13,18 +14,22 @@ namespace Umbraco.Cms.Core.Configuration.Models
public class ModelsBuilderSettings
{
private bool _flagOutOfDateModels = true;
private static string DefaultModelsDirectory => "~/umbraco/models";
internal const string StaticModelsMode = "InMemoryAuto";
internal const string StaticModelsDirectory = "~/umbraco/models";
internal const bool StaticAcceptUnsafeModelsDirectory = false;
internal const int StaticDebugLevel = 0;
/// <summary>
/// Gets or sets a value for the models mode.
/// </summary>
public ModelsMode ModelsMode { get; set; } = ModelsMode.InMemoryAuto;
[DefaultValue(StaticModelsMode)]
public ModelsMode ModelsMode { get; set; } = Enum<ModelsMode>.Parse(StaticModelsMode);
/// <summary>
/// Gets or sets a value for models namespace.
/// </summary>
/// <remarks>That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.</remarks>
[DefaultValue(Constants.ModelsBuilder.DefaultModelsNamespace)]
public string ModelsNamespace { get; set; } = Constants.ModelsBuilder.DefaultModelsNamespace;
/// <summary>
@@ -54,7 +59,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// Gets or sets a value for the models directory.
/// </summary>
/// <remarks>Default is ~/umbraco/models but that can be changed.</remarks>
public string ModelsDirectory { get; set; } = DefaultModelsDirectory;
[DefaultValue(StaticModelsDirectory)]
public string ModelsDirectory { get; set; } = StaticModelsDirectory;
/// <summary>
@@ -64,12 +70,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// An unsafe value is an absolute path, or a relative path pointing outside
/// of the website root.
/// </remarks>
public bool AcceptUnsafeModelsDirectory { get; set; } = false;
[DefaultValue(StaticAcceptUnsafeModelsDirectory)]
public bool AcceptUnsafeModelsDirectory { get; set; } = StaticAcceptUnsafeModelsDirectory;
/// <summary>
/// Gets or sets a value indicating the debug log level.
/// </summary>
/// <remarks>0 means minimal (safe on live site), anything else means more and more details (maybe not safe).</remarks>
public int DebugLevel { get; set; } = 0;
[DefaultValue(StaticDebugLevel)]
public int DebugLevel { get; set; } = StaticDebugLevel;
}
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigNuCache)]
public class NuCacheSettings
{
internal const string StaticNuCacheSerializerType = "MessagePack";
internal const int StaticSqlPageSize = 1000;
/// <summary>
/// Gets or sets a value defining the BTree block size.
/// </summary>
@@ -17,11 +22,13 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// The serializer type that nucache uses to persist documents in the database.
/// </summary>
public NuCacheSerializerType NuCacheSerializerType { get; set; } = NuCacheSerializerType.MessagePack;
[DefaultValue(StaticNuCacheSerializerType)]
public NuCacheSerializerType NuCacheSerializerType { get; set; } = Enum<NuCacheSerializerType>.Parse(StaticNuCacheSerializerType);
/// <summary>
/// The paging size to use for nucache SQL queries.
/// </summary>
public int SqlPageSize { get; set; } = 1000;
[DefaultValue(StaticSqlPageSize)]
public int SqlPageSize { get; set; } = StaticSqlPageSize;
}
}

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details.
using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Configuration.UmbracoSettings;
using Umbraco.Extensions;
@@ -13,6 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigRequestHandler)]
public class RequestHandlerSettings
{
internal const bool StaticAddTrailingSlash = true;
internal const string StaticConvertUrlsToAscii = "try";
internal static readonly CharItem[] DefaultCharCollection =
{
new CharItem { Char = " ", Replacement = "-" },
@@ -44,12 +48,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value indicating whether to add a trailing slash to URLs.
/// </summary>
public bool AddTrailingSlash { get; set; } = true;
[DefaultValue(StaticAddTrailingSlash)]
public bool AddTrailingSlash { get; set; } = StaticAddTrailingSlash;
/// <summary>
/// Gets or sets a value indicating whether to convert URLs to ASCII (valid values: "true", "try" or "false").
/// </summary>
public string ConvertUrlsToAscii { get; set; } = "try";
[DefaultValue(StaticConvertUrlsToAscii)]
public string ConvertUrlsToAscii { get; set; } = StaticConvertUrlsToAscii;
/// <summary>
/// Gets a value indicating whether URLs should be converted to ASCII.
@@ -83,6 +89,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the default character collection for replacements.
/// </summary>
/// WB-TODO
public IEnumerable<IChar> CharCollection { get; set; } = DefaultCharCollection;
/// <summary>

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Models.ContentEditing;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -6,6 +7,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigRichTextEditor)]
public class RichTextEditorSettings
{
internal const string StaticValidElements = "+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*]";
internal const string StaticInvalidElements = "font";
private static readonly string[] s_default_plugins = new[]
{
"paste",
@@ -62,11 +66,34 @@ namespace Umbraco.Cms.Core.Configuration.Models
["entity_encoding"] = "raw"
};
/// <summary>
/// HTML RichText Editor TinyMCE Commands
/// </summary>
/// WB-TODO Custom Array of objects
public RichTextEditorCommand[] Commands { get; set; } = s_default_commands;
/// <summary>
/// HTML RichText Editor TinyMCE Plugins
/// </summary>
public string[] Plugins { get; set; } = s_default_plugins;
/// <summary>
/// HTML RichText Editor TinyMCE Custom Config
/// </summary>
/// WB-TODO Custom Dictionary
public IDictionary<string, string> CustomConfig { get; set; } = s_default_custom_config;
public string ValidElements { get; set; } = "+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*]";
public string InvalidElements { get; set; } = "font";
/// <summary>
///
/// </summary>
[DefaultValue(StaticValidElements)]
public string ValidElements { get; set; } = StaticValidElements;
/// <summary>
/// Invalid HTML elements for RichText Editor
/// </summary>
[DefaultValue(StaticInvalidElements)]
public string InvalidElements { get; set; } = StaticInvalidElements;
public class RichTextEditorCommand
{

View File

@@ -1,17 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
[UmbracoOptions(Constants.Configuration.ConfigRuntimeMinification)]
public class RuntimeMinificationSettings
{
public bool UseInMemoryCache { get; set; } = false;
internal const bool StaticUseInMemoryCache = false;
internal const string StaticCacheBuster = "Version";
/// <summary>
/// Use in memory cache
/// </summary>
[DefaultValue(StaticUseInMemoryCache)]
public bool UseInMemoryCache { get; set; } = StaticUseInMemoryCache;
/// <summary>
/// The cache buster type to use
/// </summary>
public RuntimeMinificationCacheBuster CacheBuster { get; set; } = RuntimeMinificationCacheBuster.Version;
[DefaultValue(StaticCacheBuster)]
public RuntimeMinificationCacheBuster CacheBuster { get; set; } = Enum<RuntimeMinificationCacheBuster>.Parse(StaticCacheBuster);
}
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,25 +11,34 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigSecurity)]
public class SecuritySettings
{
internal const bool StaticKeepUserLoggedIn = false;
internal const bool StaticHideDisabledUsersInBackOffice = false;
internal const bool StaticAllowPasswordReset = true;
internal const string StaticAuthCookieName = "UMB_UCONTEXT";
/// <summary>
/// Gets or sets a value indicating whether to keep the user logged in.
/// </summary>
public bool KeepUserLoggedIn { get; set; } = false;
[DefaultValue(StaticKeepUserLoggedIn)]
public bool KeepUserLoggedIn { get; set; } = StaticKeepUserLoggedIn;
/// <summary>
/// Gets or sets a value indicating whether to hide disabled users in the back-office.
/// </summary>
public bool HideDisabledUsersInBackOffice { get; set; } = false;
[DefaultValue(StaticHideDisabledUsersInBackOffice)]
public bool HideDisabledUsersInBackOffice { get; set; } = StaticHideDisabledUsersInBackOffice;
/// <summary>
/// Gets or sets a value indicating whether to allow user password reset.
/// </summary>
public bool AllowPasswordReset { get; set; } = true;
[DefaultValue(StaticAllowPasswordReset)]
public bool AllowPasswordReset { get; set; } = StaticAllowPasswordReset;
/// <summary>
/// Gets or sets a value for the authorization cookie name.
/// </summary>
public string AuthCookieName { get; set; } = "UMB_UCONTEXT";
[DefaultValue(StaticAuthCookieName)]
public string AuthCookieName { get; set; } = StaticAuthCookieName;
/// <summary>
/// Gets or sets a value for the authorization cookie domain.

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Net.Mail;
using Umbraco.Cms.Core.Configuration.Models.Validation;
@@ -45,6 +46,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary>
public class SmtpSettings : ValidatableEntryBase
{
internal const string StaticSecureSocketOptions = "Auto";
internal const string StaticDeliveryMethod = "Network";
/// <summary>
/// Gets or sets a value for the SMTP from address to use for messages.
/// </summary>
@@ -65,7 +69,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the secure socket options.
/// </summary>
public SecureSocketOptions SecureSocketOptions { get; set; } = SecureSocketOptions.Auto;
[DefaultValue(StaticSecureSocketOptions)]
public SecureSocketOptions SecureSocketOptions { get; set; } = Enum<SecureSocketOptions>.Parse(StaticSecureSocketOptions);
/// <summary>
/// Gets or sets a value for the SMTP pick-up directory.
@@ -75,7 +80,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// Gets or sets a value for the SMTP delivery method.
/// </summary>
public SmtpDeliveryMethod DeliveryMethod { get; set; } = SmtpDeliveryMethod.Network;
[DefaultValue(StaticDeliveryMethod)]
public SmtpDeliveryMethod DeliveryMethod { get; set; } = Enum<SmtpDeliveryMethod>.Parse(StaticDeliveryMethod);
/// <summary>
/// Gets or sets a value for the SMTP user name.

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigTours)]
public class TourSettings
{
internal const bool StaticEnableTours = true;
/// <summary>
/// Gets or sets a value indicating whether back-office tours are enabled.
/// </summary>
public bool EnableTours { get; set; } = true;
[DefaultValue(StaticEnableTours)]
public bool EnableTours { get; set; } = StaticEnableTours;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) Umbraco.
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Collections.Generic;
@@ -11,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigPlugins)]
public class UmbracoPluginSettings
{
/// <summary>
/// Gets or sets the allowed file extensions (including the period ".") that should be accessible from the browser.
/// </summary>
/// WB-TODO
public ISet<string> BrowsableFileExtensions { get; set; } = new HashSet<string>(new[]
{
".html", // markup

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Umbraco.Cms.Core.Configuration.Models
{
@@ -9,6 +10,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigUnattended)]
public class UnattendedSettings
{
internal const bool StaticInstallUnattended = false;
internal const bool StaticUpgradeUnattended = false;
/// <summary>
/// Gets or sets a value indicating whether unattended installs are enabled.
/// </summary>
@@ -18,12 +22,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// If this option is set to <c>true</c> an unattended install will be performed and the runtime enters
/// the <c>Run</c> level.</para>
/// </remarks>
public bool InstallUnattended { get; set; } = false;
[DefaultValue(StaticInstallUnattended)]
public bool InstallUnattended { get; set; } = StaticInstallUnattended;
/// <summary>
/// Gets or sets a value indicating whether unattended upgrades are enabled.
/// </summary>
public bool UpgradeUnattended { get; set; } = false;
[DefaultValue(StaticUpgradeUnattended)]
public bool UpgradeUnattended { get; set; } = StaticUpgradeUnattended;
/// <summary>

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,25 +11,39 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigUserPassword)]
public class UserPasswordConfigurationSettings : IPasswordConfiguration
{
/// <inheritdoc/>
public int RequiredLength { get; set; } = 10;
internal const int StaticRequiredLength = 10;
internal const bool StaticRequireNonLetterOrDigit = false;
internal const bool StaticRequireDigit = false;
internal const bool StaticRequireLowercase = false;
internal const bool StaticRequireUppercase = false;
internal const int StaticMaxFailedAccessAttemptsBeforeLockout = 5;
/// <inheritdoc/>
public bool RequireNonLetterOrDigit { get; set; } = false;
[DefaultValue(StaticRequiredLength)]
public int RequiredLength { get; set; } = StaticRequiredLength;
/// <inheritdoc/>
public bool RequireDigit { get; set; } = false;
[DefaultValue(StaticRequireNonLetterOrDigit)]
public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit;
/// <inheritdoc/>
public bool RequireLowercase { get; set; } = false;
[DefaultValue(StaticRequireDigit)]
public bool RequireDigit { get; set; } = StaticRequireDigit;
/// <inheritdoc/>
public bool RequireUppercase { get; set; } = false;
[DefaultValue(StaticRequireLowercase)]
public bool RequireLowercase { get; set; } = StaticRequireLowercase;
/// <inheritdoc/>
[DefaultValue(StaticRequireUppercase)]
public bool RequireUppercase { get; set; } = StaticRequireUppercase;
/// <inheritdoc/>
[DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)]
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName;
/// <inheritdoc/>
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5;
[DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)]
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout;
}
}

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,6 +12,16 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigWebRouting)]
public class WebRoutingSettings
{
internal const bool StaticTryMatchingEndpointsForAllPages = false;
internal const bool StaticTrySkipIisCustomErrors = false;
internal const bool StaticInternalRedirectPreservesTemplate = false;
internal const bool StaticDisableAlternativeTemplates = false;
internal const bool StaticValidateAlternativeTemplates = false;
internal const bool StaticDisableFindContentByIdPath = false;
internal const bool StaticDisableRedirectUrlTracking = false;
internal const string StaticUrlProviderMode = "Auto";
/// <summary>
/// Gets or sets a value indicating whether to check if any routed endpoints match a front-end request before
/// the Umbraco dynamic router tries to map the request to an Umbraco content item.
@@ -20,42 +31,50 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// ASP.NET Core will automatically handle this in all cases. This is more of a backward compatible option since this is what v7/v8 used
/// to do.
/// </remarks>
public bool TryMatchingEndpointsForAllPages { get; set; } = false;
[DefaultValue(StaticTryMatchingEndpointsForAllPages)]
public bool TryMatchingEndpointsForAllPages { get; set; } = StaticTryMatchingEndpointsForAllPages;
/// <summary>
/// Gets or sets a value indicating whether IIS custom errors should be skipped.
/// </summary>
public bool TrySkipIisCustomErrors { get; set; } = false;
[DefaultValue(StaticTrySkipIisCustomErrors)]
public bool TrySkipIisCustomErrors { get; set; } = StaticTrySkipIisCustomErrors;
/// <summary>
/// Gets or sets a value indicating whether an internal redirect should preserve the template.
/// </summary>
public bool InternalRedirectPreservesTemplate { get; set; } = false;
[DefaultValue(StaticInternalRedirectPreservesTemplate)]
public bool InternalRedirectPreservesTemplate { get; set; } = StaticInternalRedirectPreservesTemplate;
/// <summary>
/// Gets or sets a value indicating whether the use of alternative templates are disabled.
/// </summary>
public bool DisableAlternativeTemplates { get; set; } = false;
[DefaultValue(StaticDisableAlternativeTemplates)]
public bool DisableAlternativeTemplates { get; set; } = StaticDisableAlternativeTemplates;
/// <summary>
/// Gets or sets a value indicating whether the use of alternative templates should be validated.
/// </summary>
public bool ValidateAlternativeTemplates { get; set; } = false;
[DefaultValue(StaticValidateAlternativeTemplates)]
public bool ValidateAlternativeTemplates { get; set; } = StaticValidateAlternativeTemplates;
/// <summary>
/// Gets or sets a value indicating whether find content ID by path is disabled.
/// </summary>
public bool DisableFindContentByIdPath { get; set; } = false;
[DefaultValue(StaticDisableFindContentByIdPath)]
public bool DisableFindContentByIdPath { get; set; } = StaticDisableFindContentByIdPath;
/// <summary>
/// Gets or sets a value indicating whether redirect URL tracking is disabled.
/// </summary>
public bool DisableRedirectUrlTracking { get; set; } = false;
[DefaultValue(StaticDisableRedirectUrlTracking)]
public bool DisableRedirectUrlTracking { get; set; } = StaticDisableRedirectUrlTracking;
/// <summary>
/// Gets or sets a value for the URL provider mode (<see cref="UrlMode"/>).
/// </summary>
public UrlMode UrlProviderMode { get; set; } = UrlMode.Auto;
[DefaultValue(StaticUrlProviderMode)]
public UrlMode UrlProviderMode { get; set; } = Enum<UrlMode>.Parse(StaticUrlProviderMode);
/// <summary>
/// Gets or sets a value for the Umbraco application URL.