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

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -8,6 +10,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class ContentNotificationSettings public class ContentNotificationSettings
{ {
internal const bool StaticDisableHtmlEmail = false;
/// <summary> /// <summary>
/// Gets or sets a value for the email address for notifications. /// Gets or sets a value for the email address for notifications.
/// </summary> /// </summary>
@@ -16,6 +20,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value indicating whether HTML email notifications should be disabled. /// Gets or sets a value indicating whether HTML email notifications should be disabled.
/// </summary> /// </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;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Macros; using Umbraco.Cms.Core.Macros;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -13,7 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigContent)] [UmbracoOptions(Constants.Configuration.ConfigContent)]
public class ContentSettings public class ContentSettings
{ {
private const string DefaultPreviewBadge =
internal const bool StaticResolveUrlsFromTextString = false;
internal const string StaticDefaultPreviewBadge =
@" @"
<div id=""umbracoPreviewBadge"" class=""umbraco-preview-badge""> <div id=""umbracoPreviewBadge"" class=""umbraco-preview-badge"">
<span class=""umbraco-preview-badge__header"">Preview mode</span> <span class=""umbraco-preview-badge__header"">Preview mode</span>
@@ -148,6 +151,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
</style> </style>
<script type=""text/javascript"" data-umbraco-path=""{0}"" src=""{0}/js/umbraco.websitepreview.min.js""></script>"; <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> /// <summary>
/// Gets or sets a value for the content notification settings. /// Gets or sets a value for the content notification settings.
/// </summary> /// </summary>
@@ -161,7 +170,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value indicating whether URLs should be resolved from text strings. /// Gets or sets a value indicating whether URLs should be resolved from text strings.
/// </summary> /// </summary>
public bool ResolveUrlsFromTextString { get; set; } = false; [DefaultValue(StaticResolveUrlsFromTextString)]
public bool ResolveUrlsFromTextString { get; set; } = StaticResolveUrlsFromTextString;
/// <summary> /// <summary>
/// Gets or sets a value for the collection of error pages. /// Gets or sets a value for the collection of error pages.
@@ -171,17 +181,20 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value for the preview badge mark-up. /// Gets or sets a value for the preview badge mark-up.
/// </summary> /// </summary>
public string PreviewBadge { get; set; } = DefaultPreviewBadge; [DefaultValue(StaticDefaultPreviewBadge)]
public string PreviewBadge { get; set; } = StaticDefaultPreviewBadge;
/// <summary> /// <summary>
/// Gets or sets a value for the macro error behaviour. /// Gets or sets a value for the macro error behaviour.
/// </summary> /// </summary>
public MacroErrorBehaviour MacroErrors { get; set; } = MacroErrorBehaviour.Inline; [DefaultValue(StaticMacroErrors)]
public MacroErrorBehaviour MacroErrors { get; set; } = Enum<MacroErrorBehaviour>.Parse(StaticMacroErrors);
/// <summary> /// <summary>
/// Gets or sets a value for the collection of file extensions that are disallowed for upload. /// Gets or sets a value for the collection of file extensions that are disallowed for upload.
/// </summary> /// </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> /// <summary>
/// Gets or sets a value for the collection of file extensions that are allowed for upload. /// 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> /// <summary>
/// Gets or sets a value indicating whether deprecated property editors should be shown. /// Gets or sets a value indicating whether deprecated property editors should be shown.
/// </summary> /// </summary>
public bool ShowDeprecatedPropertyEditors { get; set; } = false; [DefaultValue(StaticShowDeprecatedPropertyEditors)]
public bool ShowDeprecatedPropertyEditors { get; set; } = StaticShowDeprecatedPropertyEditors;
/// <summary> /// <summary>
/// Gets or sets a value for the path to the login screen background image. /// Gets or sets a value for the path to the login screen background image.
/// </summary> /// </summary>
public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg"; [DefaultValue(StaticLoginBackgroundImage)]
public string LoginBackgroundImage { get; set; } = StaticLoginBackgroundImage;
/// <summary> /// <summary>
/// Gets or sets a value for the path to the login screen logo image. /// Gets or sets a value for the path to the login screen logo image.
/// </summary> /// </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. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigCoreDebug)] [UmbracoOptions(Constants.Configuration.ConfigCoreDebug)]
public class CoreDebugSettings public class CoreDebugSettings
{ {
internal const bool StaticLogIncompletedScopes = false;
internal const bool StaticDumpOnTimeoutThreadAbort = false;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether incompleted scopes should be logged. /// Gets or sets a value indicating whether incompleted scopes should be logged.
/// </summary> /// </summary>
public bool LogIncompletedScopes { get; set; } = false; [DefaultValue(StaticLogIncompletedScopes)]
public bool LogIncompletedScopes { get; set; } = StaticLogIncompletedScopes;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether memory dumps on thread abort should be taken. /// Gets or sets a value indicating whether memory dumps on thread abort should be taken.
/// </summary> /// </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. // See LICENSE for more details.
using System; using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
@@ -10,24 +11,33 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class DatabaseServerMessengerSettings 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> /// <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). /// 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> /// </summary>
public int MaxProcessingInstructionCount { get; set; } = 1000; [DefaultValue(StaticMaxProcessingInstructionCount)]
public int MaxProcessingInstructionCount { get; set; } = StaticMaxProcessingInstructionCount;
/// <summary> /// <summary>
/// Gets or sets a value for 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.
/// </summary> /// </summary>
public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.FromDays(2); [DefaultValue(StaticTimeToRetainInstructions)]
public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.Parse(StaticTimeToRetainInstructions);
/// <summary> /// <summary>
/// Gets or sets a value for the time to wait between each sync operations. /// Gets or sets a value for the time to wait between each sync operations.
/// </summary> /// </summary>
public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.FromSeconds(5); [DefaultValue(StaticTimeBetweenSyncOperations)]
public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.Parse(StaticTimeBetweenSyncOperations);
/// <summary> /// <summary>
/// Gets or sets a value for the time to wait between each prune operations. /// Gets or sets a value for the time to wait between each prune operations.
/// </summary> /// </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. // See LICENSE for more details.
using System; using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
@@ -10,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class DatabaseServerRegistrarSettings public class DatabaseServerRegistrarSettings
{ {
internal const string StaticWaitTimeBetweenCalls = "00:01:00";
internal const string StaticStaleServerTimeout = "00:02:00";
/// <summary> /// <summary>
/// Gets or sets a value for 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.
/// </summary> /// </summary>
public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.FromMinutes(1); [DefaultValue(StaticWaitTimeBetweenCalls)]
public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.Parse(StaticWaitTimeBetweenCalls);
/// <summary> /// <summary>
/// Gets or sets a value for 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.
/// </summary> /// </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. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigExceptionFilter)] [UmbracoOptions(Constants.Configuration.ConfigExceptionFilter)]
public class ExceptionFilterSettings public class ExceptionFilterSettings
{ {
internal const bool StaticDisabled = false;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the exception filter is disabled. /// Gets or sets a value indicating whether the exception filter is disabled.
/// </summary> /// </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. // See LICENSE for more details.
using System; using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
@@ -11,51 +12,72 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigGlobal)] [UmbracoOptions(Constants.Configuration.ConfigGlobal)]
public class GlobalSettings public class GlobalSettings
{ {
internal const string 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 = "~/.well-known,"; // must end with a comma!
internal const string StaticTimeOut = "00:20:00";
internal const string internal const string StaticDefaultUILanguage = "en-US";
StaticReservedUrls = "~/.well-known,"; // must end with a comma! 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> /// <summary>
/// Gets or sets a value for the reserved URLs. /// Gets or sets a value for the reserved URLs.
/// It must end with a comma
/// </summary> /// </summary>
[DefaultValue(StaticReservedUrls)]
public string ReservedUrls { get; set; } = StaticReservedUrls; public string ReservedUrls { get; set; } = StaticReservedUrls;
/// <summary> /// <summary>
/// Gets or sets a value for the reserved paths. /// Gets or sets a value for the reserved paths.
/// It must end with a comma
/// </summary> /// </summary>
[DefaultValue(StaticReservedPaths)]
public string ReservedPaths { get; set; } = StaticReservedPaths; public string ReservedPaths { get; set; } = StaticReservedPaths;
/// <summary> /// <summary>
/// Gets or sets a value for the timeout /// Gets or sets a value for the timeout
/// </summary> /// </summary>
public TimeSpan TimeOut{ get; set; } = TimeSpan.FromMinutes(20); [DefaultValue(StaticTimeOut)]
public TimeSpan TimeOut { get; set; } = TimeSpan.Parse(StaticTimeOut);
/// <summary> /// <summary>
/// Gets or sets a value for the default UI language. /// Gets or sets a value for the default UI language.
/// </summary> /// </summary>
public string DefaultUILanguage { get; set; } = "en-US"; [DefaultValue(StaticDefaultUILanguage)]
public string DefaultUILanguage { get; set; } = StaticDefaultUILanguage;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to hide the top level node from the path. /// Gets or sets a value indicating whether to hide the top level node from the path.
/// </summary> /// </summary>
public bool HideTopLevelNodeFromPath { get; set; } = true; [DefaultValue(StaticHideTopLevelNodeFromPath)]
public bool HideTopLevelNodeFromPath { get; set; } = StaticHideTopLevelNodeFromPath;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether HTTPS should be used. /// Gets or sets a value indicating whether HTTPS should be used.
/// </summary> /// </summary>
public bool UseHttps { get; set; } = false; [DefaultValue(StaticUseHttps)]
public bool UseHttps { get; set; } = StaticUseHttps;
/// <summary> /// <summary>
/// Gets or sets a value for the version check period in days. /// Gets or sets a value for the version check period in days.
/// </summary> /// </summary>
public int VersionCheckPeriod { get; set; } = 7; [DefaultValue(StaticVersionCheckPeriod)]
public int VersionCheckPeriod { get; set; } = StaticVersionCheckPeriod;
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco back-office path. /// Gets or sets a value for the Umbraco back-office path.
/// </summary> /// </summary>
public string UmbracoPath { get; set; } = "~/umbraco"; [DefaultValue(StaticUmbracoPath)]
public string UmbracoPath { get; set; } = StaticUmbracoPath;
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco icons path. /// 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 /// 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. /// path given UmbracoPath if this hasn't been explicitly set.
/// </remarks> /// </remarks>
public string IconsPath { get; set; } = $"~/umbraco/assets/icons"; [DefaultValue(StaticIconsPath)]
public string IconsPath { get; set; } = StaticIconsPath;
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco CSS path. /// Gets or sets a value for the Umbraco CSS path.
/// </summary> /// </summary>
public string UmbracoCssPath { get; set; } = "~/css"; [DefaultValue(StaticUmbracoCssPath)]
public string UmbracoCssPath { get; set; } = StaticUmbracoCssPath;
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco scripts path. /// Gets or sets a value for the Umbraco scripts path.
/// </summary> /// </summary>
public string UmbracoScriptsPath { get; set; } = "~/scripts"; [DefaultValue(StaticUmbracoScriptsPath)]
public string UmbracoScriptsPath { get; set; } = StaticUmbracoScriptsPath;
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco media path. /// Gets or sets a value for the Umbraco media path.
/// </summary> /// </summary>
public string UmbracoMediaPath { get; set; } = "~/media"; [DefaultValue(StaticUmbracoMediaPath)]
public string UmbracoMediaPath { get; set; } = StaticUmbracoMediaPath;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to install the database when it is missing. /// Gets or sets a value indicating whether to install the database when it is missing.
/// </summary> /// </summary>
public bool InstallMissingDatabase { get; set; } = false; [DefaultValue(StaticInstallMissingDatabase)]
public bool InstallMissingDatabase { get; set; } = StaticInstallMissingDatabase;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to disable the election for a single server. /// Gets or sets a value indicating whether to disable the election for a single server.
/// </summary> /// </summary>
public bool DisableElectionForSingleServer { get; set; } = false; [DefaultValue(StaticDisableElectionForSingleServer)]
public bool DisableElectionForSingleServer { get; set; } = StaticDisableElectionForSingleServer;
/// <summary> /// <summary>
/// Gets or sets a value for the database factory server version. /// Gets or sets a value for the database factory server version.
@@ -106,7 +134,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value for the path to the no content view. /// Gets or sets a value for the path to the no content view.
/// </summary> /// </summary>
public string NoNodesViewPath { get; set; } = "~/umbraco/UmbracoWebsite/NoNodes.cshtml"; [DefaultValue(StaticNoNodesViewPath)]
public string NoNodesViewPath { get; set; } = StaticNoNodesViewPath;
/// <summary> /// <summary>
/// Gets or sets a value for the database server registrar settings. /// 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 /// The default value is 5000 milliseconds
/// </remarks> /// </remarks>
/// <value>The timeout in milliseconds.</value> /// <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. // See LICENSE for more details.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.HealthChecks; using Umbraco.Cms.Core.HealthChecks;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,20 +12,27 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class HealthChecksNotificationMethodSettings public class HealthChecksNotificationMethodSettings
{ {
internal const bool StaticEnabled = false;
internal const string StaticVerbosity = "Summary"; // Enum
internal const bool StaticFailureOnly = false;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the health check notification method is enabled. /// Gets or sets a value indicating whether the health check notification method is enabled.
/// </summary> /// </summary>
public bool Enabled { get; set; } = false; [DefaultValue(StaticEnabled)]
public bool Enabled { get; set; } = StaticEnabled;
/// <summary> /// <summary>
/// Gets or sets a value for the health check notifications reporting verbosity. /// Gets or sets a value for the health check notifications reporting verbosity.
/// </summary> /// </summary>
public HealthCheckNotificationVerbosity Verbosity { get; set; } = HealthCheckNotificationVerbosity.Summary; [DefaultValue(StaticVerbosity)]
public HealthCheckNotificationVerbosity Verbosity { get; set; } = Enum<HealthCheckNotificationVerbosity>.Parse(StaticVerbosity);
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the health check notifications should occur on failures only. /// Gets or sets a value indicating whether the health check notifications should occur on failures only.
/// </summary> /// </summary>
public bool FailureOnly { get; set; } = false; [DefaultValue(StaticFailureOnly)]
public bool FailureOnly { get; set; } = StaticFailureOnly;
/// <summary> /// <summary>
/// Gets or sets a value providing provider specific settings for the health check notification method. /// 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -12,10 +13,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class HealthChecksNotificationSettings public class HealthChecksNotificationSettings
{ {
internal const bool StaticEnabled = false;
internal const string StaticPeriod = "1.00:00:00"; //TimeSpan.FromHours(24);
/// <summary> /// <summary>
/// Gets or sets a value indicating whether health check notifications are enabled. /// Gets or sets a value indicating whether health check notifications are enabled.
/// </summary> /// </summary>
public bool Enabled { get; set; } = false; [DefaultValue(StaticEnabled)]
public bool Enabled { get; set; } = StaticEnabled;
/// <summary> /// <summary>
/// Gets or sets a value for the first run time of a healthcheck notification in crontab format. /// 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> /// <summary>
/// Gets or sets a value for the period of the healthcheck notification. /// Gets or sets a value for the period of the healthcheck notification.
/// </summary> /// </summary>
public TimeSpan Period { get; set; } = TimeSpan.FromHours(24); [DefaultValue(StaticPeriod)]
public TimeSpan Period { get; set; } = TimeSpan.Parse(StaticPeriod);
/// <summary> /// <summary>
/// Gets or sets a value for the collection of health check notification methods. /// Gets or sets a value for the collection of health check notification methods.

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigHosting)] [UmbracoOptions(Constants.Configuration.ConfigHosting)]
public class HostingSettings public class HostingSettings
{ {
internal const string StaticLocalTempStorageLocation = "Default";
internal const bool StaticDebug = false;
/// <summary> /// <summary>
/// Gets or sets a value for the application virtual path. /// Gets or sets a value for the application virtual path.
/// </summary> /// </summary>
@@ -17,12 +22,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value for the location of temporary files. /// Gets or sets a value for the location of temporary files.
/// </summary> /// </summary>
public LocalTempStorage LocalTempStorageLocation { get; set; } = LocalTempStorage.Default; [DefaultValue(StaticLocalTempStorageLocation)]
public LocalTempStorage LocalTempStorageLocation { get; set; } = Enum<LocalTempStorage>.Parse(StaticLocalTempStorageLocation);
/// <summary> /// <summary>
/// Gets or sets a value indicating whether umbraco is running in [debug mode]. /// Gets or sets a value indicating whether umbraco is running in [debug mode].
/// </summary> /// </summary>
/// <value><c>true</c> if [debug mode]; otherwise, <c>false</c>.</value> /// <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. // See LICENSE for more details.
using System; using System;
using System.ComponentModel;
using System.IO; using System.IO;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,24 +12,33 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class ImagingCacheSettings 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> /// <summary>
/// Gets or sets a value for the browser image cache maximum age. /// Gets or sets a value for the browser image cache maximum age.
/// </summary> /// </summary>
public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.FromDays(7); [DefaultValue(StaticBrowserMaxAge)]
public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.Parse(StaticBrowserMaxAge);
/// <summary> /// <summary>
/// Gets or sets a value for the image cache maximum age. /// Gets or sets a value for the image cache maximum age.
/// </summary> /// </summary>
public TimeSpan CacheMaxAge { get; set; } = TimeSpan.FromDays(365); [DefaultValue(StaticCacheMaxAge)]
public TimeSpan CacheMaxAge { get; set; } = TimeSpan.Parse(StaticCacheMaxAge);
/// <summary> /// <summary>
/// Gets or sets a value for length of the cached name. /// Gets or sets a value for length of the cached name.
/// </summary> /// </summary>
public uint CachedNameLength { get; set; } = 8; [DefaultValue(StaticCachedNameLength)]
public uint CachedNameLength { get; set; } = StaticCachedNameLength;
/// <summary> /// <summary>
/// Gets or sets a value for the cache folder. /// Gets or sets a value for the cache folder.
/// </summary> /// </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. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -8,14 +10,19 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// </summary> /// </summary>
public class ImagingResizeSettings public class ImagingResizeSettings
{ {
internal const int StaticMaxWidth = 5000;
internal const int StaticMaxHeight = 5000;
/// <summary> /// <summary>
/// Gets or sets a value for the maximim resize width. /// Gets or sets a value for the maximim resize width.
/// </summary> /// </summary>
public int MaxWidth { get; set; } = 5000; [DefaultValue(StaticMaxWidth)]
public int MaxWidth { get; set; } = StaticMaxWidth;
/// <summary> /// <summary>
/// Gets or sets a value for the maximim resize height. /// Gets or sets a value for the maximim resize height.
/// </summary> /// </summary>
public int MaxHeight { get; set; } = 5000; [DefaultValue(StaticMaxHeight)]
public int MaxHeight { get; set; } = StaticMaxHeight;
} }
} }

View File

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

View File

@@ -2,6 +2,7 @@
// See LICENSE for more details. // See LICENSE for more details.
using System; using System;
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
@@ -11,9 +12,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigLogging)] [UmbracoOptions(Constants.Configuration.ConfigLogging)]
public class LoggingSettings public class LoggingSettings
{ {
internal const string StaticMaxLogAge = "1.00:00:00"; // TimeSpan.FromHours(24);
/// <summary> /// <summary>
/// Gets or sets a value for the maximum age of a log file. /// Gets or sets a value for the maximum age of a log file.
/// </summary> /// </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. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,25 +11,39 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigMemberPassword)] [UmbracoOptions(Constants.Configuration.ConfigMemberPassword)]
public class MemberPasswordConfigurationSettings : IPasswordConfiguration public class MemberPasswordConfigurationSettings : IPasswordConfiguration
{ {
/// <inheritdoc/> internal const int StaticRequiredLength = 10;
public int RequiredLength { get; set; } = 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/> /// <inheritdoc/>
public bool RequireNonLetterOrDigit { get; set; } = false; [DefaultValue(StaticRequiredLength)]
public int RequiredLength { get; set; } = StaticRequiredLength;
/// <inheritdoc/> /// <inheritdoc/>
public bool RequireDigit { get; set; } = false; [DefaultValue(StaticRequireNonLetterOrDigit)]
public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit;
/// <inheritdoc/> /// <inheritdoc/>
public bool RequireLowercase { get; set; } = false; [DefaultValue(StaticRequireDigit)]
public bool RequireDigit { get; set; } = StaticRequireDigit;
/// <inheritdoc/> /// <inheritdoc/>
public bool RequireUppercase { get; set; } = false; [DefaultValue(StaticRequireLowercase)]
public bool RequireLowercase { get; set; } = StaticRequireLowercase;
/// <inheritdoc/> /// <inheritdoc/>
[DefaultValue(StaticRequireUppercase)]
public bool RequireUppercase { get; set; } = StaticRequireUppercase;
/// <inheritdoc/>
[DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)]
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName; public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName;
/// <inheritdoc/> /// <inheritdoc/>
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5; [DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)]
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout;
} }
} }

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Extensions; using Umbraco.Extensions;
@@ -13,18 +14,22 @@ namespace Umbraco.Cms.Core.Configuration.Models
public class ModelsBuilderSettings public class ModelsBuilderSettings
{ {
private bool _flagOutOfDateModels = true; private bool _flagOutOfDateModels = true;
internal const string StaticModelsMode = "InMemoryAuto";
private static string DefaultModelsDirectory => "~/umbraco/models"; internal const string StaticModelsDirectory = "~/umbraco/models";
internal const bool StaticAcceptUnsafeModelsDirectory = false;
internal const int StaticDebugLevel = 0;
/// <summary> /// <summary>
/// Gets or sets a value for the models mode. /// Gets or sets a value for the models mode.
/// </summary> /// </summary>
public ModelsMode ModelsMode { get; set; } = ModelsMode.InMemoryAuto; [DefaultValue(StaticModelsMode)]
public ModelsMode ModelsMode { get; set; } = Enum<ModelsMode>.Parse(StaticModelsMode);
/// <summary> /// <summary>
/// Gets or sets a value for models namespace. /// Gets or sets a value for models namespace.
/// </summary> /// </summary>
/// <remarks>That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.</remarks> /// <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; public string ModelsNamespace { get; set; } = Constants.ModelsBuilder.DefaultModelsNamespace;
/// <summary> /// <summary>
@@ -54,7 +59,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// Gets or sets a value for the models directory. /// Gets or sets a value for the models directory.
/// </summary> /// </summary>
/// <remarks>Default is ~/umbraco/models but that can be changed.</remarks> /// <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> /// <summary>
@@ -64,12 +70,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// An unsafe value is an absolute path, or a relative path pointing outside /// An unsafe value is an absolute path, or a relative path pointing outside
/// of the website root. /// of the website root.
/// </remarks> /// </remarks>
public bool AcceptUnsafeModelsDirectory { get; set; } = false; [DefaultValue(StaticAcceptUnsafeModelsDirectory)]
public bool AcceptUnsafeModelsDirectory { get; set; } = StaticAcceptUnsafeModelsDirectory;
/// <summary> /// <summary>
/// Gets or sets a value indicating the debug log level. /// Gets or sets a value indicating the debug log level.
/// </summary> /// </summary>
/// <remarks>0 means minimal (safe on live site), anything else means more and more details (maybe not safe).</remarks> /// <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. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigNuCache)] [UmbracoOptions(Constants.Configuration.ConfigNuCache)]
public class NuCacheSettings public class NuCacheSettings
{ {
internal const string StaticNuCacheSerializerType = "MessagePack";
internal const int StaticSqlPageSize = 1000;
/// <summary> /// <summary>
/// Gets or sets a value defining the BTree block size. /// Gets or sets a value defining the BTree block size.
/// </summary> /// </summary>
@@ -17,11 +22,13 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// The serializer type that nucache uses to persist documents in the database. /// The serializer type that nucache uses to persist documents in the database.
/// </summary> /// </summary>
public NuCacheSerializerType NuCacheSerializerType { get; set; } = NuCacheSerializerType.MessagePack; [DefaultValue(StaticNuCacheSerializerType)]
public NuCacheSerializerType NuCacheSerializerType { get; set; } = Enum<NuCacheSerializerType>.Parse(StaticNuCacheSerializerType);
/// <summary> /// <summary>
/// The paging size to use for nucache SQL queries. /// The paging size to use for nucache SQL queries.
/// </summary> /// </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. // See LICENSE for more details.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Configuration.UmbracoSettings; using Umbraco.Cms.Core.Configuration.UmbracoSettings;
using Umbraco.Extensions; using Umbraco.Extensions;
@@ -13,6 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigRequestHandler)] [UmbracoOptions(Constants.Configuration.ConfigRequestHandler)]
public class RequestHandlerSettings public class RequestHandlerSettings
{ {
internal const bool StaticAddTrailingSlash = true;
internal const string StaticConvertUrlsToAscii = "try";
internal static readonly CharItem[] DefaultCharCollection = internal static readonly CharItem[] DefaultCharCollection =
{ {
new CharItem { Char = " ", Replacement = "-" }, new CharItem { Char = " ", Replacement = "-" },
@@ -44,12 +48,14 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to add a trailing slash to URLs. /// Gets or sets a value indicating whether to add a trailing slash to URLs.
/// </summary> /// </summary>
public bool AddTrailingSlash { get; set; } = true; [DefaultValue(StaticAddTrailingSlash)]
public bool AddTrailingSlash { get; set; } = StaticAddTrailingSlash;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to convert URLs to ASCII (valid values: "true", "try" or "false"). /// Gets or sets a value indicating whether to convert URLs to ASCII (valid values: "true", "try" or "false").
/// </summary> /// </summary>
public string ConvertUrlsToAscii { get; set; } = "try"; [DefaultValue(StaticConvertUrlsToAscii)]
public string ConvertUrlsToAscii { get; set; } = StaticConvertUrlsToAscii;
/// <summary> /// <summary>
/// Gets a value indicating whether URLs should be converted to ASCII. /// Gets a value indicating whether URLs should be converted to ASCII.
@@ -83,6 +89,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary> /// <summary>
/// Gets or sets a value for the default character collection for replacements. /// Gets or sets a value for the default character collection for replacements.
/// </summary> /// </summary>
/// WB-TODO
public IEnumerable<IChar> CharCollection { get; set; } = DefaultCharCollection; public IEnumerable<IChar> CharCollection { get; set; } = DefaultCharCollection;
/// <summary> /// <summary>

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Cms.Core.Models.ContentEditing; using Umbraco.Cms.Core.Models.ContentEditing;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -6,6 +7,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigRichTextEditor)] [UmbracoOptions(Constants.Configuration.ConfigRichTextEditor)]
public class RichTextEditorSettings 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[] private static readonly string[] s_default_plugins = new[]
{ {
"paste", "paste",
@@ -62,11 +66,34 @@ namespace Umbraco.Cms.Core.Configuration.Models
["entity_encoding"] = "raw" ["entity_encoding"] = "raw"
}; };
/// <summary>
/// HTML RichText Editor TinyMCE Commands
/// </summary>
/// WB-TODO Custom Array of objects
public RichTextEditorCommand[] Commands { get; set; } = s_default_commands; public RichTextEditorCommand[] Commands { get; set; } = s_default_commands;
/// <summary>
/// HTML RichText Editor TinyMCE Plugins
/// </summary>
public string[] Plugins { get; set; } = s_default_plugins; 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 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 public class RichTextEditorCommand
{ {

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
{ {
/// <summary> /// <summary>
@@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigTours)] [UmbracoOptions(Constants.Configuration.ConfigTours)]
public class TourSettings public class TourSettings
{ {
internal const bool StaticEnableTours = true;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether back-office tours are enabled. /// Gets or sets a value indicating whether back-office tours are enabled.
/// </summary> /// </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. // See LICENSE for more details.
using System.Collections.Generic; using System.Collections.Generic;
@@ -11,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigPlugins)] [UmbracoOptions(Constants.Configuration.ConfigPlugins)]
public class UmbracoPluginSettings public class UmbracoPluginSettings
{ {
/// <summary> /// <summary>
/// Gets or sets the allowed file extensions (including the period ".") that should be accessible from the browser. /// Gets or sets the allowed file extensions (including the period ".") that should be accessible from the browser.
/// </summary> /// </summary>
/// WB-TODO
public ISet<string> BrowsableFileExtensions { get; set; } = new HashSet<string>(new[] public ISet<string> BrowsableFileExtensions { get; set; } = new HashSet<string>(new[]
{ {
".html", // markup ".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 namespace Umbraco.Cms.Core.Configuration.Models
{ {
@@ -9,6 +10,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigUnattended)] [UmbracoOptions(Constants.Configuration.ConfigUnattended)]
public class UnattendedSettings public class UnattendedSettings
{ {
internal const bool StaticInstallUnattended = false;
internal const bool StaticUpgradeUnattended = false;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether unattended installs are enabled. /// Gets or sets a value indicating whether unattended installs are enabled.
/// </summary> /// </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 /// 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> /// the <c>Run</c> level.</para>
/// </remarks> /// </remarks>
public bool InstallUnattended { get; set; } = false; [DefaultValue(StaticInstallUnattended)]
public bool InstallUnattended { get; set; } = StaticInstallUnattended;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether unattended upgrades are enabled. /// Gets or sets a value indicating whether unattended upgrades are enabled.
/// </summary> /// </summary>
public bool UpgradeUnattended { get; set; } = false; [DefaultValue(StaticUpgradeUnattended)]
public bool UpgradeUnattended { get; set; } = StaticUpgradeUnattended;
/// <summary> /// <summary>

View File

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

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco. // Copyright (c) Umbraco.
// See LICENSE for more details. // See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.Configuration.Models namespace Umbraco.Cms.Core.Configuration.Models
@@ -11,6 +12,16 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigWebRouting)] [UmbracoOptions(Constants.Configuration.ConfigWebRouting)]
public class WebRoutingSettings 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> /// <summary>
/// Gets or sets a value indicating whether to check if any routed endpoints match a front-end request before /// 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. /// 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 /// 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. /// to do.
/// </remarks> /// </remarks>
public bool TryMatchingEndpointsForAllPages { get; set; } = false; [DefaultValue(StaticTryMatchingEndpointsForAllPages)]
public bool TryMatchingEndpointsForAllPages { get; set; } = StaticTryMatchingEndpointsForAllPages;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether IIS custom errors should be skipped. /// Gets or sets a value indicating whether IIS custom errors should be skipped.
/// </summary> /// </summary>
public bool TrySkipIisCustomErrors { get; set; } = false; [DefaultValue(StaticTrySkipIisCustomErrors)]
public bool TrySkipIisCustomErrors { get; set; } = StaticTrySkipIisCustomErrors;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether an internal redirect should preserve the template. /// Gets or sets a value indicating whether an internal redirect should preserve the template.
/// </summary> /// </summary>
public bool InternalRedirectPreservesTemplate { get; set; } = false; [DefaultValue(StaticInternalRedirectPreservesTemplate)]
public bool InternalRedirectPreservesTemplate { get; set; } = StaticInternalRedirectPreservesTemplate;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the use of alternative templates are disabled. /// Gets or sets a value indicating whether the use of alternative templates are disabled.
/// </summary> /// </summary>
public bool DisableAlternativeTemplates { get; set; } = false; [DefaultValue(StaticDisableAlternativeTemplates)]
public bool DisableAlternativeTemplates { get; set; } = StaticDisableAlternativeTemplates;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the use of alternative templates should be validated. /// Gets or sets a value indicating whether the use of alternative templates should be validated.
/// </summary> /// </summary>
public bool ValidateAlternativeTemplates { get; set; } = false; [DefaultValue(StaticValidateAlternativeTemplates)]
public bool ValidateAlternativeTemplates { get; set; } = StaticValidateAlternativeTemplates;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether find content ID by path is disabled. /// Gets or sets a value indicating whether find content ID by path is disabled.
/// </summary> /// </summary>
public bool DisableFindContentByIdPath { get; set; } = false; [DefaultValue(StaticDisableFindContentByIdPath)]
public bool DisableFindContentByIdPath { get; set; } = StaticDisableFindContentByIdPath;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether redirect URL tracking is disabled. /// Gets or sets a value indicating whether redirect URL tracking is disabled.
/// </summary> /// </summary>
public bool DisableRedirectUrlTracking { get; set; } = false; [DefaultValue(StaticDisableRedirectUrlTracking)]
public bool DisableRedirectUrlTracking { get; set; } = StaticDisableRedirectUrlTracking;
/// <summary> /// <summary>
/// Gets or sets a value for the URL provider mode (<see cref="UrlMode"/>). /// Gets or sets a value for the URL provider mode (<see cref="UrlMode"/>).
/// </summary> /// </summary>
public UrlMode UrlProviderMode { get; set; } = UrlMode.Auto; [DefaultValue(StaticUrlProviderMode)]
public UrlMode UrlProviderMode { get; set; } = Enum<UrlMode>.Parse(StaticUrlProviderMode);
/// <summary> /// <summary>
/// Gets or sets a value for the Umbraco application URL. /// Gets or sets a value for the Umbraco application URL.