diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index a3ffc10a1d..74e488206e 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -31,8 +31,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
- dotnet-version: '7.x'
- include-prerelease: true
+ dotnet-version: '6.0.x'
- name: dotnet build
run: dotnet build umbraco.sln -c SkipTests
diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml
index 606e0b6a67..ae8ca25f52 100644
--- a/build/azure-pipelines.yml
+++ b/build/azure-pipelines.yml
@@ -64,11 +64,6 @@ stages:
gulpFile: src/Umbraco.Web.UI.Client/gulpfile.js
targets: coreBuild
workingDirectory: src/Umbraco.Web.UI.Client
- - task: UseDotNet@2
- displayName: Use .NET 7.x
- inputs:
- version: 7.x
- includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: Run dotnet build
inputs:
@@ -135,41 +130,41 @@ stages:
- task: PowerShell@2
displayName: Install DocFX
inputs:
- targetType: inline
- script: |
- choco install docfx --version=2.59.2 -y
- if ($lastexitcode -ne 0){
- throw ("Error installing DocFX")
- }
+ targetType: inline
+ script: |
+ choco install docfx --version=2.59.2 -y
+ if ($lastexitcode -ne 0){
+ throw ("Error installing DocFX")
+ }
- task: PowerShell@2
displayName: Generate metadata
inputs:
- targetType: inline
- script: |
- docfx metadata "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
- if ($lastexitcode -ne 0){
- throw ("Error generating metadata.")
- }
+ targetType: inline
+ script: |
+ docfx metadata "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
+ if ($lastexitcode -ne 0){
+ throw ("Error generating metadata.")
+ }
- task: PowerShell@2
displayName: Generate documentation
inputs:
- targetType: inline
- script: |
- docfx build "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
- if ($lastexitcode -ne 0){
- throw ("Error generating documentation.")
- }
+ targetType: inline
+ script: |
+ docfx build "$(Build.SourcesDirectory)/build/csharp-docs/docfx.json"
+ if ($lastexitcode -ne 0){
+ throw ("Error generating documentation.")
+ }
- task: ArchiveFiles@2
displayName: Archive C# Docs
inputs:
- rootFolderOrFile: $(Build.SourcesDirectory)/build/csharp-docs/_site
- includeRootFolder: false
- archiveFile: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
+ rootFolderOrFile: $(Build.SourcesDirectory)/build/csharp-docs/_site
+ includeRootFolder: false
+ archiveFile: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
- task: PublishPipelineArtifact@1
displayName: Publish C# Docs
inputs:
- targetPath: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
- artifact: csharp-docs
+ targetPath: $(Build.ArtifactStagingDirectory)/csharp-docs.zip
+ artifact: csharp-docs
# js API Reference
- job:
@@ -197,14 +192,14 @@ stages:
- task: ArchiveFiles@2
displayName: Archive js Docs
inputs:
- rootFolderOrFile: $(Build.SourcesDirectory)/src/Umbraco.Web.UI.Docs/api
- includeRootFolder: false
- archiveFile: $(Build.ArtifactStagingDirectory)/ui-docs.zip
+ rootFolderOrFile: $(Build.SourcesDirectory)/src/Umbraco.Web.UI.Docs/api
+ includeRootFolder: false
+ archiveFile: $(Build.ArtifactStagingDirectory)/ui-docs.zip
- task: PublishPipelineArtifact@1
displayName: Publish js Docs
inputs:
- targetPath: $(Build.ArtifactStagingDirectory)/ui-docs.zip
- artifact: ui-docs
+ targetPath: $(Build.ArtifactStagingDirectory)/ui-docs.zip
+ artifact: ui-docs
###############################################
## Test
@@ -233,10 +228,10 @@ stages:
artifact: build_output
path: $(Build.SourcesDirectory)
- task: UseDotNet@2
- displayName: Use net7
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) # net6 already on the other images
+ displayName: Use net6
inputs:
- version: 7.x
- includePreviewVersions: true
+ version: 6.x
- task: DotNetCoreCLI@2
displayName: Run dotnet test
inputs:
@@ -269,10 +264,10 @@ stages:
artifact: build_output
path: $(Build.SourcesDirectory)
- task: UseDotNet@2
- displayName: Use net7
+ displayName: Use net6
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) # net6 already on the other images
inputs:
- version: 7.x
- includePreviewVersions: true
+ version: 6.x
- task: DotNetCoreCLI@2
displayName: Run dotnet test
inputs:
@@ -310,7 +305,7 @@ stages:
- powershell: sqllocaldb start mssqllocaldb
displayName: Start localdb (Windows only)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- - powershell: docker run --name mssql -d -p 1433:1433 -e ACCEPT_EULA=Y -e SA_PASSWORD=$(SA_PASSWORD) -e MSSQL_PID=Developer mcr.microsoft.com/mssql/server:2019-latest
+ - powershell: docker run --name mssql -d -p 1433:1433 -e ACCEPT_EULA=Y -e SA_PASSWORD=$(SA_PASSWORD) -e MSSQL_PID=Developer mcr.microsoft.com/mssql/server:2019-latest
displayName: Start SQL Server (Linux only)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- task: DotNetCoreCLI@2
@@ -332,7 +327,7 @@ stages:
displayName: E2E Tests
dependsOn: Build
jobs:
- # E2E Tests
+ # E2E Tests
- job:
displayName: E2E Tests
variables:
@@ -363,7 +358,7 @@ stages:
Windows:
vmImage: 'windows-latest'
pool:
- vmImage: $(vmImage)
+ vmImage: $(vmImage)
steps:
- task: DownloadPipelineArtifact@2
displayName: Download nupkg
@@ -402,12 +397,7 @@ stages:
- powershell: Invoke-Sqlcmd -Query "CREATE DATABASE $env:UmbracoDatabaseName" -ServerInstance $env:UmbracoDatabaseServer
displayName: Create database (Windows only)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- - task: UseDotNet@2
- displayName: Use .Net 7.x
- inputs:
- version: 7.x
- includePreviewVersions: true
- # Linux containers smooth
+ # Linux containers smooth
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
displayName: Build & run container (Linux only)
@@ -492,17 +482,14 @@ stages:
inputs:
artifact: nupkg
path: $(Build.ArtifactStagingDirectory)/nupkg
- - task: DotNetCoreCLI@2
- displayName: dotnet restore
+ - task: NuGetCommand@2
+ displayName: Nuget push
inputs:
- command: restore
- projects: '**/umbraco.sln'
- # TODO: Use NuGetCommand instead of DotNetCoreCLI
- # - task: NuGetCommand@2
- # displayName: Restore NuGet Packages
- # inputs:
- # restoreSolution: 'umbraco.sln'
- # feedsToUse: config
+ command: 'push'
+ packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
+ nuGetFeedType: 'external'
+ publishFeedCredentials: 'MyGet - Pre-releases'
+
- stage: Deploy_NuGet
displayName: NuGet release
dependsOn:
@@ -519,11 +506,13 @@ stages:
inputs:
artifact: nupkg
path: $(Build.ArtifactStagingDirectory)/nupkg
- - task: DotNetCoreCLI@2
- displayName: dotnet restore
+ - task: NuGetCommand@2
+ displayName: Nuget push
inputs:
- command: restore
- projects: '**/umbraco.sln'
+ command: 'push'
+ packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
+ nuGetFeedType: 'external'
+ publishFeedCredentials: 'NuGet - Umbraco.*'
- stage: Upload_API_Docs
pool:
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 657774fcc0..ce54e08edd 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -7,7 +7,7 @@
10.0.0
10.0.0-rc1
10.0.0
- preview
+ 10.0
en-US
Umbraco CMS
Copyright © Umbraco 2021
@@ -44,11 +44,10 @@
-
-
-
-
-
-
-
+
+ true
+ 10.0.0
+ true
+ true
+
diff --git a/src/JsonSchema/JsonSchema.csproj b/src/JsonSchema/JsonSchema.csproj
index 8fa11a4bee..551d96f1fb 100644
--- a/src/JsonSchema/JsonSchema.csproj
+++ b/src/JsonSchema/JsonSchema.csproj
@@ -1,7 +1,7 @@
Exe
- net7.0
+ net6.0
true
false
false
diff --git a/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs b/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
index 1f57d99e4a..f0921f2244 100644
--- a/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
+++ b/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
@@ -62,10 +62,9 @@ public class ManagementApiComposer : IComposer
// Not super happy with this, but we need to know the UmbracoPath when registering the controller
// To be able to replace the route template token
- // TODO this is fixed in Bjarkes PR for v10, and will need to be removed in v11 merge
GlobalSettings? globalSettings =
builder.Config.GetSection(Constants.Configuration.ConfigGlobal).Get();
- var backofficePath = (globalSettings?.UmbracoPath ?? new GlobalSettings().UmbracoPath).TrimStart(Constants.CharArrays.TildeForwardSlash);
+ var backofficePath = globalSettings.UmbracoPath.TrimStart(Constants.CharArrays.TildeForwardSlash);
services.AddControllers(options =>
{
diff --git a/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj b/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj
index a3a34e178b..2fd111bfa8 100644
--- a/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj
+++ b/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
enable
enable
nullable
diff --git a/src/Umbraco.Cms.Persistence.SqlServer/Umbraco.Cms.Persistence.SqlServer.csproj b/src/Umbraco.Cms.Persistence.SqlServer/Umbraco.Cms.Persistence.SqlServer.csproj
index e78c210ae2..e206cd8653 100644
--- a/src/Umbraco.Cms.Persistence.SqlServer/Umbraco.Cms.Persistence.SqlServer.csproj
+++ b/src/Umbraco.Cms.Persistence.SqlServer/Umbraco.Cms.Persistence.SqlServer.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Umbraco.Cms.Persistence.SqlServer
Umbraco.Cms.Persistence.SqlServer
Adds support for SQL Server to Umbraco CMS.
diff --git a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj
index 943757b353..5aa062df17 100644
--- a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj
+++ b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Umbraco.Cms.Persistence.Sqlite
Umbraco.Cms.Persistence.Sqlite
Adds support for SQLite to Umbraco CMS.
@@ -12,7 +12,6 @@
-
diff --git a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
index 89cb8a44aa..1fbbd8c42f 100644
--- a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
+++ b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
true
Umbraco.Cms.StaticAssets
Contains the static assets that is required to run Umbraco CMS.
diff --git a/src/Umbraco.Cms/Umbraco.Cms.csproj b/src/Umbraco.Cms/Umbraco.Cms.csproj
index ce43dc67fc..c6c63108ff 100644
--- a/src/Umbraco.Cms/Umbraco.Cms.csproj
+++ b/src/Umbraco.Cms/Umbraco.Cms.csproj
@@ -1,6 +1,6 @@
- net7.0
+ net6.0
false
Umbraco.Cms
Umbraco.Cms
diff --git a/src/Umbraco.Core/Composing/IUserComposer.cs b/src/Umbraco.Core/Composing/IUserComposer.cs
new file mode 100644
index 0000000000..a3e45054f8
--- /dev/null
+++ b/src/Umbraco.Core/Composing/IUserComposer.cs
@@ -0,0 +1,9 @@
+namespace Umbraco.Cms.Core.Composing;
+
+///
+/// Represents a user .
+///
+[Obsolete("This interface is obsolete. Use IComposer instead.")]
+public interface IUserComposer : IComposer
+{
+}
diff --git a/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs b/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs
index 69ef69239e..cd256e1b45 100644
--- a/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs
+++ b/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs
@@ -23,13 +23,8 @@ public class ConfigureConnectionStrings : IConfigureNamedOptions Configure(Options.DefaultName, options);
///
- public void Configure(string? name, ConnectionStrings options)
+ public void Configure(string name, ConnectionStrings options)
{
- if (name is null)
- {
- throw new InvalidOperationException("The name of the option instance is required.");
- }
-
// Default to using UmbracoConnectionName
if (name == Options.DefaultName)
{
diff --git a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs
index 672577b1b7..0c5d39f47a 100644
--- a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs
@@ -19,36 +19,30 @@ public class RequestHandlerSettings
internal static readonly CharItem[] DefaultCharCollection =
{
- new() { Char = " ", Replacement = "-" },
- new() { Char = "\"", Replacement = string.Empty },
- new() { Char = "'", Replacement = string.Empty },
- new() { Char = "%", Replacement = string.Empty },
- new() { Char = ".", Replacement = string.Empty },
- new() { Char = ";", Replacement = string.Empty },
- new() { Char = "/", Replacement = string.Empty },
- new() { Char = "\\", Replacement = string.Empty },
- new() { Char = ":", Replacement = string.Empty },
- new() { Char = "#", Replacement = string.Empty },
- new() { Char = "&", Replacement = string.Empty },
- new() { Char = "?", Replacement = string.Empty },
- new() { Char = "<", Replacement = string.Empty },
- new() { Char = ">", Replacement = string.Empty },
- new() { Char = "+", Replacement = "plus" },
- new() { Char = "*", Replacement = "star" },
- new() { Char = "æ", Replacement = "ae" },
- new() { Char = "Æ", Replacement = "ae" },
- new() { Char = "ä", Replacement = "ae" },
- new() { Char = "Ä", Replacement = "ae" },
- new() { Char = "ø", Replacement = "oe" },
- new() { Char = "Ø", Replacement = "oe" },
- new() { Char = "ö", Replacement = "oe" },
- new() { Char = "Ö", Replacement = "oe" },
- new() { Char = "å", Replacement = "aa" },
- new() { Char = "Å", Replacement = "aa" },
- new() { Char = "ü", Replacement = "ue" },
- new() { Char = "Ü", Replacement = "ue" },
- new() { Char = "ß", Replacement = "ss" },
- new() { Char = "|", Replacement = "-" },
+ new () { Char = " ", Replacement = "-" },
+ new () { Char = "\"", Replacement = string.Empty },
+ new () { Char = "'", Replacement = string.Empty },
+ new () { Char = "%", Replacement = string.Empty },
+ new () { Char = ".", Replacement = string.Empty },
+ new () { Char = ";", Replacement = string.Empty },
+ new () { Char = "/", Replacement = string.Empty },
+ new () { Char = "\\", Replacement = string.Empty },
+ new () { Char = ":", Replacement = string.Empty },
+ new () { Char = "#", Replacement = string.Empty },
+ new () { Char = "+", Replacement = "plus" },
+ new () { Char = "*", Replacement = "star" },
+ new () { Char = "&", Replacement = string.Empty },
+ new () { Char = "?", Replacement = string.Empty },
+ new () { Char = "æ", Replacement = "ae" },
+ new () { Char = "ä", Replacement = "ae" },
+ new () { Char = "ø", Replacement = "oe" },
+ new () { Char = "ö", Replacement = "oe" },
+ new () { Char = "å", Replacement = "aa" },
+ new () { Char = "ü", Replacement = "ue" },
+ new () { Char = "ß", Replacement = "ss" },
+ new () { Char = "|", Replacement = "-" },
+ new () { Char = "<", Replacement = string.Empty },
+ new () { Char = ">", Replacement = string.Empty },
};
///
@@ -79,6 +73,13 @@ public class RequestHandlerSettings
[DefaultValue(StaticEnableDefaultCharReplacements)]
public bool EnableDefaultCharReplacements { get; set; } = StaticEnableDefaultCharReplacements;
+ ///
+ /// Add additional character replacements, or override defaults
+ ///
+ [Obsolete(
+ "Use the GetCharReplacements extension method in the Umbraco.Extensions namespace instead. Scheduled for removal in V11")]
+ public IEnumerable CharCollection { get; set; } = DefaultCharCollection;
+
///
/// Add additional character replacements, or override defaults
///
diff --git a/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs
index 5062dc87e4..0798014600 100644
--- a/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs
+++ b/src/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidator.cs
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Configuration.Models.Validation;
public class ContentSettingsValidator : ConfigurationValidatorBase, IValidateOptions
{
///
- public ValidateOptionsResult Validate(string? name, ContentSettings options)
+ public ValidateOptionsResult Validate(string name, ContentSettings options)
{
if (!ValidateError404Collection(options.Error404Collection, out var message))
{
diff --git a/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs
index f78ce306dd..32ad130c33 100644
--- a/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs
+++ b/src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs
@@ -12,7 +12,7 @@ public class GlobalSettingsValidator
: ConfigurationValidatorBase, IValidateOptions
{
///
- public ValidateOptionsResult Validate(string? name, GlobalSettings options)
+ public ValidateOptionsResult Validate(string name, GlobalSettings options)
{
if (!ValidateSmtpSetting(options.Smtp, out var message))
{
diff --git a/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs
index 2b55afdcb0..ac0e1651ea 100644
--- a/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs
+++ b/src/Umbraco.Core/Configuration/Models/Validation/HealthChecksSettingsValidator.cs
@@ -19,7 +19,7 @@ public class HealthChecksSettingsValidator : ConfigurationValidatorBase, IValida
public HealthChecksSettingsValidator(ICronTabParser cronTabParser) => _cronTabParser = cronTabParser;
///
- public ValidateOptionsResult Validate(string? name, HealthChecksSettings options)
+ public ValidateOptionsResult Validate(string name, HealthChecksSettings options)
{
if (!ValidateNotificationFirstRunTime(options.Notification.FirstRunTime, out var message))
{
diff --git a/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs
index 8515fc3cc4..4a1872cf30 100644
--- a/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs
+++ b/src/Umbraco.Core/Configuration/Models/Validation/RequestHandlerSettingsValidator.cs
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Configuration.Models.Validation;
public class RequestHandlerSettingsValidator : ConfigurationValidatorBase, IValidateOptions
{
///
- public ValidateOptionsResult Validate(string? name, RequestHandlerSettings options)
+ public ValidateOptionsResult Validate(string name, RequestHandlerSettings options)
{
if (!ValidateConvertUrlsToAscii(options.ConvertUrlsToAscii, out var message))
{
diff --git a/src/Umbraco.Core/Configuration/Models/Validation/UnattendedSettingsValidator.cs b/src/Umbraco.Core/Configuration/Models/Validation/UnattendedSettingsValidator.cs
index 473224553a..e262de76e7 100644
--- a/src/Umbraco.Core/Configuration/Models/Validation/UnattendedSettingsValidator.cs
+++ b/src/Umbraco.Core/Configuration/Models/Validation/UnattendedSettingsValidator.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
using Microsoft.Extensions.Options;
@@ -12,7 +12,7 @@ public class UnattendedSettingsValidator
: IValidateOptions
{
///
- public ValidateOptionsResult Validate(string? name, UnattendedSettings options)
+ public ValidateOptionsResult Validate(string name, UnattendedSettings options)
{
if (options.InstallUnattended)
{
diff --git a/src/Umbraco.Core/Constants-Conventions.cs b/src/Umbraco.Core/Constants-Conventions.cs
index 22acf8cc4d..7b221e1435 100644
--- a/src/Umbraco.Core/Constants-Conventions.cs
+++ b/src/Umbraco.Core/Constants-Conventions.cs
@@ -178,6 +178,68 @@ public static partial class Constants
public const string CommentsLabel = "Comments";
+ ///
+ /// Property alias for the Approved boolean of a Member
+ ///
+ [Obsolete(
+ "IsApproved is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string IsApproved = "umbracoMemberApproved";
+
+ [Obsolete("Use the stateApproved translation in the user area instead, scheduled for removal in V11")]
+ public const string IsApprovedLabel = "Is Approved";
+
+ ///
+ /// Property alias for the Locked out boolean of a Member
+ ///
+ [Obsolete(
+ "IsLockedOut is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string IsLockedOut = "umbracoMemberLockedOut";
+
+ [Obsolete("Use the stateLockedOut translation in the user area instead, scheduled for removal in V11")]
+ public const string IsLockedOutLabel = "Is Locked Out";
+
+ ///
+ /// Property alias for the last date the Member logged in
+ ///
+ [Obsolete(
+ "LastLoginDate is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string LastLoginDate = "umbracoMemberLastLogin";
+
+ [Obsolete("Use the lastLogin translation in the user area instead, scheduled for removal in V11")]
+ public const string LastLoginDateLabel = "Last Login Date";
+
+ ///
+ /// Property alias for the last date a Member changed its password
+ ///
+ [Obsolete(
+ "LastPasswordChangeDate is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string LastPasswordChangeDate = "umbracoMemberLastPasswordChangeDate";
+
+ [Obsolete(
+ "Use the lastPasswordChangeDate translation in the user area instead, scheduled for removal in V11")]
+ public const string LastPasswordChangeDateLabel = "Last Password Change Date";
+
+ ///
+ /// Property alias for the last date a Member was locked out
+ ///
+ [Obsolete(
+ "LastLockoutDate is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string LastLockoutDate = "umbracoMemberLastLockoutDate";
+
+ [Obsolete("Use the lastLockoutDate translation in the user area instead, scheduled for removal in V11")]
+ public const string LastLockoutDateLabel = "Last Lockout Date";
+
+ ///
+ /// Property alias for the number of failed login attempts
+ ///
+ [Obsolete(
+ "FailedPasswordAttempts is no longer property data, access the property directly on IMember instead, scheduled for removal in V11")]
+ public const string FailedPasswordAttempts = "umbracoMemberFailedPasswordAttempts";
+
+ [Obsolete(
+ "Use the failedPasswordAttempts translation in the user area instead, scheduled for removal in V11")]
+ public const string FailedPasswordAttemptsLabel = "Failed Password Attempts";
+
///
/// The standard properties group alias for membership properties.
///
diff --git a/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs b/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs
index 579a34894a..ec26080e76 100644
--- a/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs
+++ b/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs
@@ -68,7 +68,16 @@ public static class ServiceCollectionExtensions
services.AddUnique(factory => (TImplementing)factory.GetRequiredService(), lifetime);
}
- ///
+ // TODO(V11): Remove this function.
+ [Obsolete("This method is functionally equivalent to AddSingleton() please use that instead.")]
+ public static void AddUnique(this IServiceCollection services)
+ where TImplementing : class
+ {
+ services.RemoveAll();
+ services.AddSingleton();
+ }
+
+ ///
/// Adds a service of type with an implementation factory method to the specified
/// .
///
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs
index fc78d985f7..c409a849ec 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs
@@ -84,8 +84,12 @@ public static partial class UmbracoBuilderExtensions
return builder;
}
+ [Obsolete("Use AddEmbedProvider instead. This will be removed in Umbraco 11")]
+ public static IUmbracoBuilder AddOEmbedProvider(this IUmbracoBuilder builder)
+ where T : class, IEmbedProvider => AddEmbedProvider(builder);
+
///
- /// Register a section.
+ /// Register a section.
///
/// The type of the section.
/// The builder.
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
index 280d7ce492..c699e09743 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
@@ -272,6 +272,14 @@ public static partial class UmbracoBuilderExtensions
public static MediaUrlGeneratorCollectionBuilder MediaUrlGenerators(this IUmbracoBuilder builder)
=> builder.WithCollectionBuilder();
+ ///
+ /// Gets the backoffice OEmbed Providers collection builder.
+ ///
+ /// The builder.
+ [Obsolete("Use EmbedProviders() instead")]
+ public static EmbedProvidersCollectionBuilder OEmbedProviders(this IUmbracoBuilder builder)
+ => EmbedProviders(builder);
+
///
/// Gets the backoffice Embed Providers collection builder.
///
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
index 31ef06c400..6efd096c68 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
@@ -103,6 +103,8 @@ public static partial class UmbracoBuilderExtensions
Constants.Configuration.NamedOptions.InstallDefaultData.MemberTypes,
builder.Config.GetSection($"{Constants.Configuration.ConfigInstallDefaultData}:{Constants.Configuration.NamedOptions.InstallDefaultData.MemberTypes}"));
+ builder.Services.Configure(options => options.MergeReplacements(builder.Config));
+
// TODO: Remove this in V12
// This is to make the move of the AllowEditInvariantFromNonDefault setting from SecuritySettings to ContentSettings backwards compatible
// If there is a value in security settings, but no value in content setting we'll use that value, otherwise content settings always wins.
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
index d806950584..4bfe7fd7bd 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
@@ -307,6 +307,7 @@ namespace Umbraco.Cms.Core.DependencyInjection
factory.GetRequiredService(),
factory.GetRequiredService()
));
+ Services.AddUnique(factory => factory.GetRequiredService());
Services.AddUnique(factory => factory.GetRequiredService());
Services.AddUnique(factory => new LocalizedTextService(
factory.GetRequiredService>(),
diff --git a/src/Umbraco.Core/Extensions/EnumExtensions.cs b/src/Umbraco.Core/Extensions/EnumExtensions.cs
index c88a2d8b2f..3aa124d2f3 100644
--- a/src/Umbraco.Core/Extensions/EnumExtensions.cs
+++ b/src/Umbraco.Core/Extensions/EnumExtensions.cs
@@ -1,31 +1,42 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
-using System;
+namespace Umbraco.Extensions;
-namespace Umbraco.Extensions
+///
+/// Provides extension methods to .
+///
+public static class EnumExtensions
{
///
- /// Provides extension methods to .
+ /// Determines whether all the flags/bits are set within the enum value.
///
- public static class EnumExtensions
- {
- ///
- /// Determines whether any of the flags/bits are set within the enum value.
- ///
- /// The enum type.
- /// The value.
- /// The flags.
- ///
- /// true if any of the flags/bits are set within the enum value; otherwise, false.
- ///
- public static bool HasFlagAny(this T value, T flags)
- where T : Enum
- {
- var v = Convert.ToUInt64(value);
- var f = Convert.ToUInt64(flags);
+ /// The enum type.
+ /// The enum value.
+ /// The flags.
+ ///
+ /// true if all the flags/bits are set within the enum value; otherwise, false.
+ ///
+ [Obsolete("Use Enum.HasFlag() or bitwise operations (if performance is important) instead.")]
+ public static bool HasFlagAll(this T value, T flags)
+ where T : Enum =>
+ value.HasFlag(flags);
- return (v & f) > 0;
- }
+ ///
+ /// Determines whether any of the flags/bits are set within the enum value.
+ ///
+ /// The enum type.
+ /// The value.
+ /// The flags.
+ ///
+ /// true if any of the flags/bits are set within the enum value; otherwise, false.
+ ///
+ public static bool HasFlagAny(this T value, T flags)
+ where T : Enum
+ {
+ var v = Convert.ToUInt64(value);
+ var f = Convert.ToUInt64(flags);
+
+ return (v & f) > 0;
}
}
diff --git a/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs b/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs
index 8699950b37..475f093785 100644
--- a/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs
+++ b/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs
@@ -7,13 +7,13 @@ namespace Umbraco.Extensions;
///
/// Get concatenated user and default character replacements
-/// taking into account .
+/// taking into account
///
public static class RequestHandlerSettingsExtension
{
///
/// Get concatenated user and default character replacements
- /// taking into account .
+ /// taking into account
///
public static IEnumerable GetCharReplacements(this RequestHandlerSettings requestHandlerSettings)
{
@@ -28,8 +28,31 @@ public static class RequestHandlerSettingsExtension
return RequestHandlerSettings.DefaultCharCollection;
}
- /// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection.
- return MergeUnique(requestHandlerSettings.UserDefinedCharCollection, RequestHandlerSettings.DefaultCharCollection);
+ return MergeUnique(
+ requestHandlerSettings.UserDefinedCharCollection,
+ RequestHandlerSettings.DefaultCharCollection);
+ }
+
+ ///
+ /// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection
+ ///
+ internal static void MergeReplacements(
+ this RequestHandlerSettings requestHandlerSettings,
+ IConfiguration configuration)
+ {
+ var sectionKey = $"{Constants.Configuration.ConfigRequestHandler}:";
+
+ IEnumerable charCollection = GetReplacements(
+ configuration,
+ $"{sectionKey}{nameof(RequestHandlerSettings.CharCollection)}");
+
+ IEnumerable userDefinedCharCollection = GetReplacements(
+ configuration,
+ $"{sectionKey}{nameof(requestHandlerSettings.UserDefinedCharCollection)}");
+
+ IEnumerable mergedCollection = MergeUnique(userDefinedCharCollection, charCollection);
+
+ requestHandlerSettings.UserDefinedCharCollection = mergedCollection;
}
private static IEnumerable GetReplacements(IConfiguration configuration, string key)
@@ -41,12 +64,6 @@ public static class RequestHandlerSettingsExtension
{
var @char = section.GetValue(nameof(CharItem.Char));
var replacement = section.GetValue(nameof(CharItem.Replacement));
-
- if (@char is null || replacement is null)
- {
- continue;
- }
-
replacements.Add(new CharItem { Char = @char, Replacement = replacement });
}
@@ -54,7 +71,8 @@ public static class RequestHandlerSettingsExtension
}
///
- /// Merges two IEnumerable of CharItem without any duplicates, items in priorityReplacements will override those in alternativeReplacements.
+ /// Merges two IEnumerable of CharItem without any duplicates, items in priorityReplacements will override those in
+ /// alternativeReplacements
///
private static IEnumerable MergeUnique(
IEnumerable priorityReplacements,
diff --git a/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs b/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs
index 9a0ecf57ae..5e830e1f61 100644
--- a/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs
+++ b/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs
@@ -19,6 +19,18 @@ public abstract class BaseHttpHeaderCheck : HealthCheck
private readonly string _localizedTextPrefix;
private readonly bool _metaTagOptionAvailable;
+ [Obsolete("Use ctor without value.")]
+ protected BaseHttpHeaderCheck(
+ IHostingEnvironment hostingEnvironment,
+ ILocalizedTextService textService,
+ string header,
+ string value,
+ string localizedTextPrefix,
+ bool metaTagOptionAvailable)
+ : this(hostingEnvironment, textService, header, localizedTextPrefix, metaTagOptionAvailable)
+ {
+ }
+
///
/// Initializes a new instance of the class.
///
diff --git a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs
index 1dfa72039c..b8960048f6 100644
--- a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs
+++ b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs
@@ -2,7 +2,7 @@ namespace Umbraco.Cms.Core.Hosting;
public interface IHostingEnvironment
{
- string? SiteName { get; }
+ string SiteName { get; }
///
/// The unique application ID for this Umbraco website.
diff --git a/src/Umbraco.Core/IO/ViewHelper.cs b/src/Umbraco.Core/IO/ViewHelper.cs
index e68101918a..e2502e4669 100644
--- a/src/Umbraco.Core/IO/ViewHelper.cs
+++ b/src/Umbraco.Core/IO/ViewHelper.cs
@@ -11,11 +11,21 @@ public class ViewHelper : IViewHelper
private readonly IDefaultViewContentProvider _defaultViewContentProvider;
private readonly IFileSystem _viewFileSystem;
- public ViewHelper(FileSystems fileSystems, IDefaultViewContentProvider defaultViewContentProvider)
- {
- _viewFileSystem = fileSystems.MvcViewsFileSystem ?? throw new ArgumentNullException(nameof(fileSystems));
- _defaultViewContentProvider = defaultViewContentProvider ?? throw new ArgumentNullException(nameof(defaultViewContentProvider));
- }[Obsolete("Inject IDefaultViewContentProvider instead")]
+ [Obsolete("Use ctor with all params")]
+ public ViewHelper(IFileSystem viewFileSystem)
+ {
+ _viewFileSystem = viewFileSystem ?? throw new ArgumentNullException(nameof(viewFileSystem));
+ _defaultViewContentProvider = StaticServiceProvider.Instance.GetRequiredService();
+ }
+
+ public ViewHelper(FileSystems fileSystems, IDefaultViewContentProvider defaultViewContentProvider)
+ {
+ _viewFileSystem = fileSystems.MvcViewsFileSystem ?? throw new ArgumentNullException(nameof(fileSystems));
+ _defaultViewContentProvider = defaultViewContentProvider ??
+ throw new ArgumentNullException(nameof(defaultViewContentProvider));
+ }
+
+ [Obsolete("Inject IDefaultViewContentProvider instead")]
public static string GetDefaultFileContent(string? layoutPageAlias = null, string? modelClassName = null, string? modelNamespace = null, string? modelNamespaceAlias = null)
{
IDefaultViewContentProvider viewContentProvider =
diff --git a/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs b/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
index 17b89d8ec0..6db33486f5 100644
--- a/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
+++ b/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
@@ -29,11 +29,20 @@ public class TelemetryIdentifierStep : InstallSetupStep
[DataMember(Name = "newPassword")]
- public required string NewPassword { get; set; }
+ public string? NewPassword { get; set; }
///
/// The old password - used to change a password when: EnablePasswordRetrieval = false
diff --git a/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs b/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs
index 1e648f949f..1c04496e04 100644
--- a/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs
+++ b/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Extensions;
@@ -22,4 +22,13 @@ public class UserGroupPermissionsSave
///
[DataMember(Name = "permissions")]
public IDictionary> AssignedPermissions { get; set; }
+
+ [Obsolete("This is not used and will be removed in Umbraco 10")]
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (AssignedPermissions.SelectMany(x => x.Value).Any(x => x.IsNullOrWhiteSpace()))
+ {
+ yield return new ValidationResult("A permission value cannot be null or empty", new[] { "Permissions" });
+ }
+ }
}
diff --git a/src/Umbraco.Core/Models/ContentType.cs b/src/Umbraco.Core/Models/ContentType.cs
index c31f5f72ff..f4fe617a83 100644
--- a/src/Umbraco.Core/Models/ContentType.cs
+++ b/src/Umbraco.Core/Models/ContentType.cs
@@ -10,7 +10,7 @@ namespace Umbraco.Cms.Core.Models;
///
[Serializable]
[DataContract(IsReference = true)]
-public class ContentType : ContentTypeCompositionBase, IContentType
+public class ContentType : ContentTypeCompositionBase, IContentTypeWithHistoryCleanup
{
public const bool SupportsPublishingConst = true;
diff --git a/src/Umbraco.Core/Models/IContentType.cs b/src/Umbraco.Core/Models/IContentType.cs
index f43764faeb..5d76c49b88 100644
--- a/src/Umbraco.Core/Models/IContentType.cs
+++ b/src/Umbraco.Core/Models/IContentType.cs
@@ -2,6 +2,19 @@ using Umbraco.Cms.Core.Models.ContentEditing;
namespace Umbraco.Cms.Core.Models;
+///
+/// Defines a content type that contains a history cleanup policy.
+///
+[Obsolete("This will be merged into IContentType in Umbraco 10.")]
+public interface IContentTypeWithHistoryCleanup : IContentType
+{
+ ///
+ /// Gets or sets the history cleanup configuration.
+ ///
+ /// The history cleanup configuration.
+ HistoryCleanup? HistoryCleanup { get; set; }
+}
+
///
/// Defines a ContentType, which Content is based on
///
@@ -55,10 +68,4 @@ public interface IContentType : IContentTypeComposition
///
///
IContentType DeepCloneWithResetIdentities(string newAlias);
-
- ///
- /// Gets or sets the history cleanup configuration.
- ///
- /// The history cleanup configuration.
- HistoryCleanup? HistoryCleanup { get; set; }
}
diff --git a/src/Umbraco.Core/Models/Language.cs b/src/Umbraco.Core/Models/Language.cs
index 2072533917..9299665755 100644
--- a/src/Umbraco.Core/Models/Language.cs
+++ b/src/Umbraco.Core/Models/Language.cs
@@ -29,14 +29,22 @@ public class Language : EntityBase, ILanguage
_cultureName = cultureName ?? throw new ArgumentNullException(nameof(cultureName));
}
- ///
- [DataMember]
- public string IsoCode
+ [Obsolete(
+ "Use the constructor not requiring global settings and accepting an explicit name instead, scheduled for removal in V11.")]
+ public Language(GlobalSettings globalSettings, string isoCode)
+ {
+ _isoCode = isoCode ?? throw new ArgumentNullException(nameof(isoCode));
+ _cultureName = CultureInfo.GetCultureInfo(isoCode).EnglishName;
+ }
+
+ ///
+ [DataMember]
+ public string IsoCode
+ {
+ get => _isoCode;
+ set
{
- get => _isoCode;
- set
- {
- ArgumentNullException.ThrowIfNull(value);
+ ArgumentNullException.ThrowIfNull(value);
SetPropertyValueAndDetectChanges(value, ref _isoCode!, nameof(IsoCode));
}
diff --git a/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs
index 5d35e3a32a..5829512648 100644
--- a/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs
+++ b/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs
@@ -1,4 +1,5 @@
using System.Globalization;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
@@ -9,6 +10,7 @@ using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
+using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Models.Mapping;
@@ -32,12 +34,48 @@ public class ContentTypeMapDefinition : IMapDefinition
private readonly IShortStringHelper _shortStringHelper;
private ContentSettings _contentSettings;
- public ContentTypeMapDefinition(CommonMapper commonMapper, PropertyEditorCollection propertyEditors,
- IDataTypeService dataTypeService, IFileService fileService,
- IContentTypeService contentTypeService, IMediaTypeService mediaTypeService,
+ [Obsolete("Use ctor with all params injected")]
+ public ContentTypeMapDefinition(
+ CommonMapper commonMapper,
+ PropertyEditorCollection propertyEditors,
+ IDataTypeService dataTypeService,
+ IFileService fileService,
+ IContentTypeService contentTypeService,
+ IMediaTypeService mediaTypeService,
IMemberTypeService memberTypeService,
- ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IOptions globalSettings,
- IHostingEnvironment hostingEnvironment, IOptionsMonitor contentSettings)
+ ILoggerFactory loggerFactory,
+ IShortStringHelper shortStringHelper,
+ IOptions globalSettings,
+ IHostingEnvironment hostingEnvironment)
+ : this(
+ commonMapper,
+ propertyEditors,
+ dataTypeService,
+ fileService,
+ contentTypeService,
+ mediaTypeService,
+ memberTypeService,
+ loggerFactory,
+ shortStringHelper,
+ globalSettings,
+ hostingEnvironment,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
+ public ContentTypeMapDefinition(
+ CommonMapper commonMapper,
+ PropertyEditorCollection propertyEditors,
+ IDataTypeService dataTypeService,
+ IFileService fileService,
+ IContentTypeService contentTypeService,
+ IMediaTypeService mediaTypeService,
+ IMemberTypeService memberTypeService,
+ ILoggerFactory loggerFactory,
+ IShortStringHelper shortStringHelper,
+ IOptions globalSettings,
+ IHostingEnvironment hostingEnvironment,
+ IOptionsMonitor contentSettings)
{
_commonMapper = commonMapper;
_propertyEditors = propertyEditors;
@@ -56,6 +94,32 @@ public class ContentTypeMapDefinition : IMapDefinition
contentSettings.OnChange(x => _contentSettings = x);
}
+ public static Udi? MapContentTypeUdi(IContentTypeComposition source)
+ {
+ if (source == null)
+ {
+ return null;
+ }
+
+ string udiType;
+ switch (source)
+ {
+ case IMemberType _:
+ udiType = Constants.UdiEntityType.MemberType;
+ break;
+ case IMediaType _:
+ udiType = Constants.UdiEntityType.MediaType;
+ break;
+ case IContentType _:
+ udiType = Constants.UdiEntityType.DocumentType;
+ break;
+ default:
+ throw new PanicException($"Source is of type {source.GetType()} which isn't supported here");
+ }
+
+ return Udi.Create(udiType, source.Key);
+ }
+
public void DefineMaps(IUmbracoMapper mapper)
{
mapper.Define(
@@ -107,52 +171,7 @@ public class ContentTypeMapDefinition : IMapDefinition
(source, context) => new MemberPropertyTypeDisplay(), Map);
}
- public static Udi? MapContentTypeUdi(IContentTypeComposition source)
- {
- if (source == null)
- {
- return null;
- }
-
- string udiType;
- switch (source)
- {
- case IMemberType _:
- udiType = Constants.UdiEntityType.MemberType;
- break;
- case IMediaType _:
- udiType = Constants.UdiEntityType.MediaType;
- break;
- case IContentType _:
- udiType = Constants.UdiEntityType.DocumentType;
- break;
- default:
- throw new PanicException($"Source is of type {source.GetType()} which isn't supported here");
- }
-
- return Udi.Create(udiType, source.Key);
- }
-
- // no MapAll - take care
- private void Map(DocumentTypeSave source, IContentType target, MapperContext context)
- {
- MapSaveToTypeBase(source, target, context);
- MapComposition(source, target, alias => _contentTypeService.Get(alias));
-
- MapHistoryCleanup(source, target);
-
- target.AllowedTemplates = source.AllowedTemplates?
- .Where(x => x != null)
- .Select(_fileService.GetTemplate)
- .WhereNotNull()
- .ToArray();
-
- target.SetDefaultTemplate(source.DefaultTemplate == null
- ? null
- : _fileService.GetTemplate(source.DefaultTemplate));
- }
-
- private static void MapHistoryCleanup(DocumentTypeSave source, IContentType target)
+ private static void MapHistoryCleanup(DocumentTypeSave source, IContentTypeWithHistoryCleanup target)
{
// If source history cleanup is null we don't have to map all properties
if (source.HistoryCleanup is null)
@@ -228,6 +247,28 @@ public class ContentTypeMapDefinition : IMapDefinition
target.SortOrder = source.SortOrder;
}
+ // no MapAll - take care
+ private void Map(DocumentTypeSave source, IContentType target, MapperContext context)
+ {
+ MapSaveToTypeBase(source, target, context);
+ MapComposition(source, target, alias => _contentTypeService.Get(alias));
+
+ if (target is IContentTypeWithHistoryCleanup targetWithHistoryCleanup)
+ {
+ MapHistoryCleanup(source, targetWithHistoryCleanup);
+ }
+
+ target.AllowedTemplates = source.AllowedTemplates?
+ .Where(x => x != null)
+ .Select(_fileService.GetTemplate)
+ .WhereNotNull()
+ .ToArray();
+
+ target.SetDefaultTemplate(source.DefaultTemplate == null
+ ? null
+ : _fileService.GetTemplate(source.DefaultTemplate));
+ }
+
// no MapAll - take care
private void Map(MediaTypeSave source, IMediaType target, MapperContext context)
{
@@ -262,7 +303,7 @@ public class ContentTypeMapDefinition : IMapDefinition
{
MapTypeToDisplayBase(source, target);
- if (source is IContentType sourceWithHistoryCleanup)
+ if (source is IContentTypeWithHistoryCleanup sourceWithHistoryCleanup)
{
target.HistoryCleanup = new HistoryCleanupViewModel
{
@@ -275,7 +316,7 @@ public class ContentTypeMapDefinition : IMapDefinition
_contentSettings.ContentVersionCleanupPolicy.KeepAllVersionsNewerThanDays,
GlobalKeepLatestVersionPerDayForDays =
_contentSettings.ContentVersionCleanupPolicy.KeepLatestVersionPerDayForDays,
- GlobalEnableCleanup = _contentSettings.ContentVersionCleanupPolicy.EnableCleanup
+ GlobalEnableCleanup = _contentSettings.ContentVersionCleanupPolicy.EnableCleanup,
};
}
@@ -454,8 +495,7 @@ public class ContentTypeMapDefinition : IMapDefinition
source, target, context);
// Umbraco.Code.MapAll -CreateDate -UpdateDate -DeleteDate -Key -PropertyTypes
- private static void Map(PropertyGroupBasic source, PropertyGroup target,
- MapperContext context)
+ private static void Map(PropertyGroupBasic source, PropertyGroup target, MapperContext context)
{
if (source.Id > 0)
{
@@ -896,8 +936,7 @@ public class ContentTypeMapDefinition : IMapDefinition
}
}
- private static void MapComposition(ContentTypeSave source, IContentTypeComposition target,
- Func getContentType)
+ private static void MapComposition(ContentTypeSave source, IContentTypeComposition target, Func getContentType)
{
var current = target.CompositionAliases().ToArray();
IEnumerable proposed = source.CompositeContentTypes;
diff --git a/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs
index 3c79d1c12f..e1550971e1 100644
--- a/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs
+++ b/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs
@@ -15,6 +15,11 @@ public class DictionaryMapDefinition : IMapDefinition
private readonly CommonMapper? _commonMapper;
private readonly ILocalizationService _localizationService;
+ [Obsolete("Use the constructor with the CommonMapper")]
+ public DictionaryMapDefinition(ILocalizationService localizationService) : this(localizationService, StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
public DictionaryMapDefinition(ILocalizationService localizationService, CommonMapper commonMapper)
{
_localizationService = localizationService;
@@ -25,7 +30,9 @@ public class DictionaryMapDefinition : IMapDefinition
{
mapper.Define((source, context) => new EntityBasic(), Map);
mapper.Define((source, context) => new DictionaryDisplay(), Map);
- mapper.Define((source, context) => new DictionaryOverviewDisplay(), Map);
+ mapper.Define(
+ (source, context) => new DictionaryOverviewDisplay(),
+ Map);
}
// Umbraco.Code.MapAll -ParentId -Path -Trashed -Udi -Icon
diff --git a/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs b/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs
index 65db6181dd..ae9876628f 100644
--- a/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs
+++ b/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs
@@ -70,8 +70,7 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper
return resolved;
}
- // We need this because we call GetCustomGenericProperties from TabsAndPropertiesMapper
- // and we have no access to MapMembershipProperties from the base class without casting
+ [Obsolete("Use MapMembershipProperties. Will be removed in Umbraco 10.")]
protected override IEnumerable GetCustomGenericProperties(IContentBase content)
{
var member = (IMember)content;
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
index aeee722ed2..bd5e7af0a4 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
@@ -56,6 +56,21 @@ namespace Umbraco.Cms.Core.Models.PublishedContent
InitializeIndexes();
}
+ [Obsolete("Use the overload specifying a key instead")]
+ public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, IEnumerable propertyTypes, ContentVariation variations, bool isElement = false)
+ : this (Guid.Empty, id, alias, itemType, compositionAliases, variations, isElement)
+ {
+ PublishedPropertyType[] propertyTypesA = propertyTypes.ToArray();
+ foreach (PublishedPropertyType propertyType in propertyTypesA)
+ {
+ propertyType.ContentType = this;
+ }
+
+ _propertyTypes = propertyTypesA;
+
+ InitializeIndexes();
+ }
+
///
/// This constructor is for tests and is not intended to be used directly from application code.
///
@@ -70,6 +85,15 @@ namespace Umbraco.Cms.Core.Models.PublishedContent
InitializeIndexes();
}
+ [Obsolete("Use the overload specifying a key instead")]
+ public PublishedContentType(int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, Func> propertyTypes, ContentVariation variations, bool isElement = false)
+ : this(Guid.Empty, id, alias, itemType, compositionAliases, variations, isElement)
+ {
+ _propertyTypes = propertyTypes(this).ToArray();
+
+ InitializeIndexes();
+ }
+
private PublishedContentType(Guid key, int id, string alias, PublishedItemType itemType, IEnumerable compositionAliases, ContentVariation variations, bool isElement)
{
Key = key;
diff --git a/src/Umbraco.Core/Models/RelationType.cs b/src/Umbraco.Core/Models/RelationType.cs
index 519885b7fa..d48e802c6e 100644
--- a/src/Umbraco.Core/Models/RelationType.cs
+++ b/src/Umbraco.Core/Models/RelationType.cs
@@ -1,4 +1,4 @@
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
using Umbraco.Cms.Core.Models.Entities;
namespace Umbraco.Cms.Core.Models;
@@ -22,7 +22,14 @@ public class RelationType : EntityBase, IRelationTypeWithIsDependency
{
}
- public RelationType(string? name, string? alias, bool isBidrectional, Guid? parentObjectType, Guid? childObjectType, bool isDependency){
+ [Obsolete("Use ctor with isDependency parameter")]
+ public RelationType(string name, string alias, bool isBidrectional, Guid? parentObjectType, Guid? childObjectType)
+ : this(name, alias, isBidrectional, parentObjectType, childObjectType, false)
+ {
+ }
+
+ public RelationType(string? name, string? alias, bool isBidrectional, Guid? parentObjectType, Guid? childObjectType, bool isDependency)
+ {
if (name == null)
{
throw new ArgumentNullException(nameof(name));
diff --git a/src/Umbraco.Core/Models/SendCodeViewModel.cs b/src/Umbraco.Core/Models/SendCodeViewModel.cs
index 29d318f8ff..c73fd73eb3 100644
--- a/src/Umbraco.Core/Models/SendCodeViewModel.cs
+++ b/src/Umbraco.Core/Models/SendCodeViewModel.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Cms.Core.Models;
@@ -11,11 +11,11 @@ public class Verify2FACodeModel
{
[Required]
[DataMember(Name = "code", IsRequired = true)]
- public required string Code { get; set; }
+ public string? Code { get; set; }
[Required]
[DataMember(Name = "provider", IsRequired = true)]
- public required string Provider { get; set; }
+ public string? Provider { get; set; }
///
/// Flag indicating whether the sign-in cookie should persist after the browser is closed.
diff --git a/src/Umbraco.Core/Models/SetPasswordModel.cs b/src/Umbraco.Core/Models/SetPasswordModel.cs
index 58803c101d..57d1abc38f 100644
--- a/src/Umbraco.Core/Models/SetPasswordModel.cs
+++ b/src/Umbraco.Core/Models/SetPasswordModel.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Cms.Core.Models;
@@ -12,9 +12,9 @@ public class SetPasswordModel
[Required]
[DataMember(Name = "password", IsRequired = true)]
- public required string Password { get; set; }
+ public string? Password { get; set; }
[Required]
[DataMember(Name = "resetCode", IsRequired = true)]
- public required string ResetCode { get; set; }
+ public string? ResetCode { get; set; }
}
diff --git a/src/Umbraco.Core/Models/UnLinkLoginModel.cs b/src/Umbraco.Core/Models/UnLinkLoginModel.cs
index ba4d881b73..c121230810 100644
--- a/src/Umbraco.Core/Models/UnLinkLoginModel.cs
+++ b/src/Umbraco.Core/Models/UnLinkLoginModel.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Cms.Core.Models;
@@ -7,9 +7,9 @@ public class UnLinkLoginModel
{
[Required]
[DataMember(Name = "loginProvider", IsRequired = true)]
- public required string LoginProvider { get; set; }
+ public string? LoginProvider { get; set; }
[Required]
[DataMember(Name = "providerKey", IsRequired = true)]
- public required string ProviderKey { get; set; }
+ public string? ProviderKey { get; set; }
}
diff --git a/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs b/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs
new file mode 100644
index 0000000000..036d5cf8a4
--- /dev/null
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Umbraco.
+// See LICENSE for more details.
+
+namespace Umbraco.Cms.Core.Notifications;
+
+// TODO (V10): Remove this class.
+
+///
+/// Notification that occurs during the Umbraco boot process, before instances of initialize.
+///
+[Obsolete(
+ "This notification was added to the core runtime start-up as a hook for Umbraco Cloud local connection string and database setup. " +
+ "Following re-work they are no longer used (from Deploy 9.2.0)." +
+ "Given they are non-documented and no other use is expected, they can be removed in the next major release")]
+public class UmbracoApplicationComponentsInstallingNotification : INotification
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The runtime level
+ public UmbracoApplicationComponentsInstallingNotification(RuntimeLevel runtimeLevel) => RuntimeLevel = runtimeLevel;
+
+ ///
+ /// Gets the runtime level of execution.
+ ///
+ public RuntimeLevel RuntimeLevel { get; }
+}
diff --git a/src/Umbraco.Core/Notifications/UmbracoApplicationMainDomAcquiredNotification.cs b/src/Umbraco.Core/Notifications/UmbracoApplicationMainDomAcquiredNotification.cs
new file mode 100644
index 0000000000..2bbab6e7ec
--- /dev/null
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationMainDomAcquiredNotification.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Umbraco.
+// See LICENSE for more details.
+
+namespace Umbraco.Cms.Core.Notifications;
+
+// TODO (V10): Remove this class.
+
+///
+/// Notification that occurs during Umbraco boot after the MainDom has been acquired.
+///
+[Obsolete(
+ "This notification was added to the core runtime start-up as a hook for Umbraco Cloud local connection string and database setup. " +
+ "Following re-work they are no longer used (from Deploy 9.2.0)." +
+ "Given they are non-documented and no other use is expected, they can be removed in the next major release")]
+public class UmbracoApplicationMainDomAcquiredNotification : INotification
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UmbracoApplicationMainDomAcquiredNotification()
+ {
+ }
+}
diff --git a/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs b/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs
index 49eaac02f2..7c7e97f29f 100644
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs
@@ -2,21 +2,32 @@ namespace Umbraco.Cms.Core.Notifications;
///
/// Notification that occurs at the very end of the Umbraco boot process (after all s are
-/// initialized).
+/// initialized).
+///
+///
+public class UmbracoApplicationStartingNotification : IUmbracoApplicationLifetimeNotification
+{
+ ///
+ /// Initializes a new instance of the class.
///
- ///
- public class UmbracoApplicationStartingNotification : IUmbracoApplicationLifetimeNotification
+ /// The runtime level
+ [Obsolete("Use ctor with all params")]
+ public UmbracoApplicationStartingNotification(RuntimeLevel runtimeLevel)
+ : this(runtimeLevel, false)
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The runtime level
- /// Indicates whether Umbraco is restarting.
- public UmbracoApplicationStartingNotification(RuntimeLevel runtimeLevel, bool isRestarting)
- {
- RuntimeLevel = runtimeLevel;
- IsRestarting = isRestarting;
- }
+ // TODO: Remove this constructor in V10
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The runtime level
+ /// Indicates whether Umbraco is restarting.
+ public UmbracoApplicationStartingNotification(RuntimeLevel runtimeLevel, bool isRestarting)
+ {
+ RuntimeLevel = runtimeLevel;
+ IsRestarting = isRestarting;
+ }
///
/// Gets the runtime level.
diff --git a/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs b/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs
index 8face75954..a877bd3162 100644
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs
@@ -1,17 +1,26 @@
namespace Umbraco.Cms.Core.Notifications;
+///
+/// Notification that occurs when Umbraco is shutting down (after all s are terminated).
+///
+///
+public class UmbracoApplicationStoppingNotification : IUmbracoApplicationLifetimeNotification
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [Obsolete("Use ctor with all params")]
+ public UmbracoApplicationStoppingNotification()
+ : this(false)
+ {
+ // TODO: Remove this constructor in V10
+ }
///
- /// Notification that occurs when Umbraco is shutting down (after all s are terminated).
+ /// Initializes a new instance of the class.
///
- ///
- public class UmbracoApplicationStoppingNotification : IUmbracoApplicationLifetimeNotification
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// Indicates whether Umbraco is restarting.
- public UmbracoApplicationStoppingNotification(bool isRestarting) => IsRestarting = isRestarting;
+ /// Indicates whether Umbraco is restarting.
+ public UmbracoApplicationStoppingNotification(bool isRestarting) => IsRestarting = isRestarting;
///
public bool IsRestarting { get; }
diff --git a/src/Umbraco.Core/Persistence/Repositories/IExternalLoginRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IExternalLoginRepository.cs
new file mode 100644
index 0000000000..6d7370768c
--- /dev/null
+++ b/src/Umbraco.Core/Persistence/Repositories/IExternalLoginRepository.cs
@@ -0,0 +1,26 @@
+using Umbraco.Cms.Core.Security;
+
+namespace Umbraco.Cms.Core.Persistence.Repositories;
+
+public interface IExternalLoginRepository : IReadWriteQueryRepository,
+ IQueryRepository
+{
+ ///
+ /// Replaces all external login providers for the user
+ ///
+ ///
+ ///
+ [Obsolete("Use method that takes guid as param from IExternalLoginWithKeyRepository")]
+ void Save(int userId, IEnumerable logins);
+
+ ///
+ /// Replaces all external login provider tokens for the providers specified for the user
+ ///
+ ///
+ ///
+ [Obsolete("Use method that takes guid as param from IExternalLoginWithKeyRepository")]
+ void Save(int userId, IEnumerable tokens);
+
+ [Obsolete("Use method that takes guid as param from IExternalLoginWithKeyRepository")]
+ void DeleteUserLogins(int memberId);
+}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs
index 136abec3c4..9d2fe0ecbf 100644
--- a/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs
@@ -1,11 +1,8 @@
-using Umbraco.Cms.Core.Models;
+using Umbraco.Cms.Core.Models;
namespace Umbraco.Cms.Core.Persistence.Repositories;
public interface IMacroRepository : IReadWriteQueryRepository, IReadRepository
{
- IMacro? GetByAlias(string alias);
-
- IEnumerable GetAllByAlias(string[] aliases);
-
+ // IEnumerable GetAll(params string[] aliases);
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs
new file mode 100644
index 0000000000..48ead78759
--- /dev/null
+++ b/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs
@@ -0,0 +1,11 @@
+using Umbraco.Cms.Core.Models;
+
+namespace Umbraco.Cms.Core.Persistence.Repositories;
+
+[Obsolete("This interface will be merged with IMacroRepository in Umbraco 11")]
+public interface IMacroWithAliasRepository : IMacroRepository
+{
+ IMacro? GetByAlias(string alias);
+
+ IEnumerable GetAllByAlias(string[] aliases);
+}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs
index 32c04bdb4b..58475f802d 100644
--- a/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs
@@ -38,4 +38,20 @@ public interface IMemberRepository : IContentRepository
///
///
int GetCountByQuery(IQuery? query);
+
+ ///
+ /// Sets a members last login date based on their username
+ ///
+ ///
+ ///
+ ///
+ /// This is a specialized method because whenever a member logs in, the membership provider requires us to set the
+ /// 'online' which requires
+ /// updating their login date. This operation must be fast and cannot use database locks which is fine if we are only
+ /// executing a single query
+ /// for this data since there won't be any other data contention issues.
+ ///
+ [Obsolete(
+ "This is now a NoOp since last login date is no longer an umbraco property, set the date on the IMember directly and Save it instead, scheduled for removal in V11.")]
+ void SetLastLogin(string username, DateTime date);
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IUserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IUserRepository.cs
index 35458d6eba..893a3c248e 100644
--- a/src/Umbraco.Core/Persistence/Repositories/IUserRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/IUserRepository.cs
@@ -1,4 +1,4 @@
-using System.Linq.Expressions;
+using System.Linq.Expressions;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Persistence.Querying;
@@ -13,6 +13,14 @@ public interface IUserRepository : IReadWriteQueryRepository
///
int GetCountByQuery(IQuery? query);
+ ///
+ /// Checks if a user with the username exists
+ ///
+ ///
+ ///
+ [Obsolete("This method will be removed in future versions. Please use ExistsByUserName instead.")]
+ bool Exists(string username);
+
///
/// Checks if a user with the username exists
///
diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs
index 2e26894d23..d73eb5a2eb 100644
--- a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs
+++ b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs
@@ -1,4 +1,4 @@
-using Umbraco.Cms.Core.Models.PublishedContent;
+using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.PropertyEditors;
diff --git a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs
index 6506d29725..d0a238dbb2 100644
--- a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs
+++ b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs
@@ -24,20 +24,37 @@ public class DefaultUrlProvider : IUrlProvider
private readonly UriUtility _uriUtility;
private RequestHandlerSettings _requestSettings;
- public DefaultUrlProvider(
- IOptionsMonitor requestSettings,
- ILogger logger,
- ISiteDomainMapper siteDomainMapper,
- IUmbracoContextAccessor umbracoContextAccessor,
- UriUtility uriUtility,
- ILocalizationService localizationService)
- {
- _requestSettings = requestSettings.CurrentValue;
- _logger = logger;
- _siteDomainMapper = siteDomainMapper;
- _umbracoContextAccessor = umbracoContextAccessor;
- _uriUtility = uriUtility;
- _localizationService = localizationService;
+ [Obsolete("Use ctor with all parameters")]
+ public DefaultUrlProvider(
+ IOptionsMonitor requestSettings,
+ ILogger logger,
+ ISiteDomainMapper siteDomainMapper,
+ IUmbracoContextAccessor umbracoContextAccessor,
+ UriUtility uriUtility)
+ : this(
+ requestSettings,
+ logger,
+ siteDomainMapper,
+ umbracoContextAccessor,
+ uriUtility,
+ StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
+ public DefaultUrlProvider(
+ IOptionsMonitor requestSettings,
+ ILogger logger,
+ ISiteDomainMapper siteDomainMapper,
+ IUmbracoContextAccessor umbracoContextAccessor,
+ UriUtility uriUtility,
+ ILocalizationService localizationService)
+ {
+ _requestSettings = requestSettings.CurrentValue;
+ _logger = logger;
+ _siteDomainMapper = siteDomainMapper;
+ _umbracoContextAccessor = umbracoContextAccessor;
+ _uriUtility = uriUtility;
+ _localizationService = localizationService;
requestSettings.OnChange(x => _requestSettings = x);
}
diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
index 60ad1f10ba..0a744f3f0f 100644
--- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
@@ -539,7 +539,7 @@ internal class EntityXmlSerializer : IEntityXmlSerializer
genericProperties,
tabs);
- if (contentType is IContentType withCleanup && withCleanup.HistoryCleanup is not null)
+ if (contentType is IContentTypeWithHistoryCleanup withCleanup && withCleanup.HistoryCleanup is not null)
{
xml.Add(SerializeCleanupPolicy(withCleanup.HistoryCleanup));
}
diff --git a/src/Umbraco.Core/Services/ExternalLoginService.cs b/src/Umbraco.Core/Services/ExternalLoginService.cs
index 061e0b93aa..677108dbcd 100644
--- a/src/Umbraco.Core/Services/ExternalLoginService.cs
+++ b/src/Umbraco.Core/Services/ExternalLoginService.cs
@@ -9,7 +9,7 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Services;
-public class ExternalLoginService : RepositoryService, IExternalLoginWithKeyService
+public class ExternalLoginService : RepositoryService, IExternalLoginService, IExternalLoginWithKeyService
{
private readonly IExternalLoginWithKeyRepository _externalLoginRepository;
@@ -21,6 +21,37 @@ public class ExternalLoginService : RepositoryService, IExternalLoginWithKeyServ
: base(provider, loggerFactory, eventMessagesFactory) =>
_externalLoginRepository = externalLoginRepository;
+ [Obsolete("Use ctor injecting IExternalLoginWithKeyRepository")]
+ public ExternalLoginService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IExternalLoginRepository externalLoginRepository)
+ : this(provider, loggerFactory, eventMessagesFactory, StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
+ ///
+ [Obsolete("Use overload that takes a user/member key (Guid).")]
+ public IEnumerable GetExternalLogins(int userId)
+ => GetExternalLogins(userId.ToGuid());
+
+ ///
+ [Obsolete("Use overload that takes a user/member key (Guid).")]
+ public IEnumerable GetExternalLoginTokens(int userId) =>
+ GetExternalLoginTokens(userId.ToGuid());
+
+ ///
+ [Obsolete("Use overload that takes a user/member key (Guid).")]
+ public void Save(int userId, IEnumerable logins)
+ => Save(userId.ToGuid(), logins);
+
+ ///
+ [Obsolete("Use overload that takes a user/member key (Guid).")]
+ public void Save(int userId, IEnumerable tokens)
+ => Save(userId.ToGuid(), tokens);
+
+ ///
+ [Obsolete("Use overload that takes a user/member key (Guid).")]
+ public void DeleteUserLogins(int userId)
+ => DeleteUserLogins(userId.ToGuid());
+
public IEnumerable Find(string loginProvider, string providerKey)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
diff --git a/src/Umbraco.Core/Services/IExternalLoginService.cs b/src/Umbraco.Core/Services/IExternalLoginService.cs
new file mode 100644
index 0000000000..ba75d505ff
--- /dev/null
+++ b/src/Umbraco.Core/Services/IExternalLoginService.cs
@@ -0,0 +1,63 @@
+using Umbraco.Cms.Core.Security;
+
+namespace Umbraco.Cms.Core.Services;
+
+///
+/// Used to store the external login info
+///
+[Obsolete("Use IExternalLoginServiceWithKey. This will be removed in Umbraco 10")]
+public interface IExternalLoginService : IService
+{
+ ///
+ /// Returns all user logins assigned
+ ///
+ ///
+ ///
+ IEnumerable GetExternalLogins(int userId);
+
+ ///
+ /// Returns all user login tokens assigned
+ ///
+ ///
+ ///
+ IEnumerable GetExternalLoginTokens(int userId);
+
+ ///
+ /// Returns all logins matching the login info - generally there should only be one but in some cases
+ /// there might be more than one depending on if an administrator has been editing/removing members
+ ///
+ ///
+ ///
+ ///
+ IEnumerable Find(string loginProvider, string providerKey);
+
+ ///
+ /// Saves the external logins associated with the user
+ ///
+ ///
+ /// The user associated with the logins
+ ///
+ ///
+ ///
+ /// This will replace all external login provider information for the user
+ ///
+ void Save(int userId, IEnumerable logins);
+
+ ///
+ /// Saves the external login tokens associated with the user
+ ///
+ ///
+ /// The user associated with the tokens
+ ///
+ ///
+ ///
+ /// This will replace all external login tokens for the user
+ ///
+ void Save(int userId, IEnumerable tokens);
+
+ ///
+ /// Deletes all user logins - normally used when a member is deleted
+ ///
+ ///
+ void DeleteUserLogins(int userId);
+}
diff --git a/src/Umbraco.Core/Services/IMacroService.cs b/src/Umbraco.Core/Services/IMacroService.cs
index ef99248727..141b278d93 100644
--- a/src/Umbraco.Core/Services/IMacroService.cs
+++ b/src/Umbraco.Core/Services/IMacroService.cs
@@ -49,12 +49,5 @@ public interface IMacroService : IService
/////
///// Alias to retrieve an for
///// An object
- //IMacroPropertyType GetMacroPropertyTypeByAlias(string alias);
-
- ///
- /// Gets a list of available objects by alias.
- ///
- /// Optional array of aliases to limit the results
- /// An enumerable list of objects
- IEnumerable GetAll(params string[] aliases);
+ // IMacroPropertyType GetMacroPropertyTypeByAlias(string alias);
}
diff --git a/src/Umbraco.Core/Services/IMacroWithAliasService.cs b/src/Umbraco.Core/Services/IMacroWithAliasService.cs
new file mode 100644
index 0000000000..508168b877
--- /dev/null
+++ b/src/Umbraco.Core/Services/IMacroWithAliasService.cs
@@ -0,0 +1,14 @@
+using Umbraco.Cms.Core.Models;
+
+namespace Umbraco.Cms.Core.Services;
+
+[Obsolete("This interface will be merged with IMacroService in Umbraco 11")]
+public interface IMacroWithAliasService : IMacroService
+{
+ ///
+ /// Gets a list of available objects by alias.
+ ///
+ /// Optional array of aliases to limit the results
+ /// An enumerable list of objects
+ IEnumerable GetAll(params string[] aliases);
+}
diff --git a/src/Umbraco.Core/Services/IMembershipMemberService.cs b/src/Umbraco.Core/Services/IMembershipMemberService.cs
index 553441f572..dc96535f8b 100644
--- a/src/Umbraco.Core/Services/IMembershipMemberService.cs
+++ b/src/Umbraco.Core/Services/IMembershipMemberService.cs
@@ -128,6 +128,20 @@ public interface IMembershipMemberService : IService
/// or to Delete
void Delete(T membershipUser);
+ ///
+ /// Sets the last login date for the member if they are found by username
+ ///
+ ///
+ ///
+ ///
+ /// This is a specialized method because whenever a member logs in, the membership provider requires us to set the
+ /// 'online' which requires
+ /// updating their login date. This operation must be fast and cannot use database locks which is fine if we are only
+ /// executing a single query
+ /// for this data since there won't be any other data contention issues.
+ ///
+ void SetLastLogin(string username, DateTime date);
+
///
/// Saves an
///
diff --git a/src/Umbraco.Core/Services/ITwoFactorLoginService.cs b/src/Umbraco.Core/Services/ITwoFactorLoginService.cs
index 0a0cc751d5..d0509a9283 100644
--- a/src/Umbraco.Core/Services/ITwoFactorLoginService.cs
+++ b/src/Umbraco.Core/Services/ITwoFactorLoginService.cs
@@ -52,17 +52,15 @@ public interface ITwoFactorLoginService : IService
Task SaveAsync(TwoFactorLogin twoFactorLogin);
///
- /// Gets all the enabled 2FA providers for the user or member with the specified key.
+ /// Gets all the enabled 2FA providers for the user or member with the specified key.
///
Task> GetEnabledTwoFactorProviderNamesAsync(Guid userOrMemberKey);
+}
- ///
- /// Disables 2FA with Code.
- ///
+[Obsolete("This will be merged into ITwoFactorLoginService in Umbraco 11")]
+public interface ITwoFactorLoginService2 : ITwoFactorLoginService
+{
Task DisableWithCodeAsync(string providerName, Guid userOrMemberKey, string code);
- ///
- /// Validates and Saves.
- ///
Task ValidateAndSaveAsync(string providerName, Guid userKey, string secret, string code);
}
diff --git a/src/Umbraco.Core/Services/LocalizedTextService.cs b/src/Umbraco.Core/Services/LocalizedTextService.cs
index 1634f60baa..839e52f49e 100644
--- a/src/Umbraco.Core/Services/LocalizedTextService.cs
+++ b/src/Umbraco.Core/Services/LocalizedTextService.cs
@@ -64,16 +64,27 @@ public class LocalizedTextService : ILocalizedTextService
XmlSourceToNoAreaDictionary(source));
}
- ///
- /// Initializes with a source of a dictionary of culture -> areas -> sub dictionary of keys/values
- ///
- ///
- ///
- public LocalizedTextService(
- IDictionary>>> source,
- ILogger logger)
- {
- IDictionary>>> dictionarySource =
+ [Obsolete(
+ "Use other ctor with IDictionary>>> as input parameter.")]
+ public LocalizedTextService(
+ IDictionary>> source,
+ ILogger logger)
+ : this(
+ source.ToDictionary(x => x.Key, x => new Lazy>>(() => x.Value)),
+ logger)
+ {
+ }
+
+ ///
+ /// Initializes with a source of a dictionary of culture -> areas -> sub dictionary of keys/values
+ ///
+ ///
+ ///
+ public LocalizedTextService(
+ IDictionary>>> source,
+ ILogger logger)
+ {
+ IDictionary>>> dictionarySource =
source ?? throw new ArgumentNullException(nameof(source));
_dictionarySourceLazy =
new Lazy>>>>(() =>
diff --git a/src/Umbraco.Core/Services/MacroService.cs b/src/Umbraco.Core/Services/MacroService.cs
index be07d1ef02..73889895e2 100644
--- a/src/Umbraco.Core/Services/MacroService.cs
+++ b/src/Umbraco.Core/Services/MacroService.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
@@ -10,7 +10,7 @@ namespace Umbraco.Cms.Core.Services;
///
/// Represents the Macro Service, which is an easy access to operations involving
///
-internal class MacroService : RepositoryService, IMacroService
+internal class MacroService : RepositoryService, IMacroWithAliasService
{
private readonly IAuditRepository _auditRepository;
private readonly IMacroRepository _macroRepository;
@@ -34,7 +34,7 @@ internal class MacroService : RepositoryService, IMacroService
/// An object
public IMacro? GetByAlias(string alias)
{
- if (_macroRepository is not IMacroRepository macroWithAliasRepository)
+ if (_macroRepository is not IMacroWithAliasRepository macroWithAliasRepository)
{
return GetAll().FirstOrDefault(x => x.Alias == alias);
}
@@ -65,7 +65,7 @@ internal class MacroService : RepositoryService, IMacroService
public IEnumerable GetAll(params string[] aliases)
{
- if (_macroRepository is not IMacroRepository macroWithAliasRepository)
+ if (_macroRepository is not IMacroWithAliasRepository macroWithAliasRepository)
{
var hashset = new HashSet(aliases);
return GetAll().Where(x => hashset.Contains(x.Alias));
diff --git a/src/Umbraco.Core/Services/MemberService.cs b/src/Umbraco.Core/Services/MemberService.cs
index d8f9f787aa..76d730dc78 100644
--- a/src/Umbraco.Core/Services/MemberService.cs
+++ b/src/Umbraco.Core/Services/MemberService.cs
@@ -728,7 +728,11 @@ namespace Umbraco.Cms.Core.Services
#region Save
- public void SetLastLogin(string username, DateTime date) => throw new NotImplementedException();
+ ///
+ [Obsolete("This is now a NoOp since last login date is no longer an umbraco property, set the date on the IMember directly and Save it instead, scheduled for removal in V11.")]
+ public void SetLastLogin(string username, DateTime date)
+ {
+ }
///
public void Save(IMember member)
diff --git a/src/Umbraco.Core/Services/ServiceContext.cs b/src/Umbraco.Core/Services/ServiceContext.cs
index 9def2bd8fa..0e24f27be5 100644
--- a/src/Umbraco.Core/Services/ServiceContext.cs
+++ b/src/Umbraco.Core/Services/ServiceContext.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Cms.Core.Services;
+namespace Umbraco.Cms.Core.Services;
///
/// Represents the Umbraco Service context, which provides access to all services.
@@ -13,7 +13,7 @@ public class ServiceContext
private readonly Lazy? _dataTypeService;
private readonly Lazy? _domainService;
private readonly Lazy? _entityService;
- private readonly Lazy? _externalLoginService;
+ private readonly Lazy? _externalLoginService;
private readonly Lazy? _fileService;
private readonly Lazy? _keyValueService;
private readonly Lazy? _localizationService;
@@ -59,7 +59,7 @@ public class ServiceContext
Lazy? memberTypeService,
Lazy? memberGroupService,
Lazy? notificationService,
- Lazy? externalLoginService,
+ Lazy? externalLoginService,
Lazy? redirectUrlService,
Lazy? consentService,
Lazy? keyValueService,
@@ -207,7 +207,7 @@ public class ServiceContext
///
/// Gets the ExternalLoginService.
///
- public IExternalLoginWithKeyService? ExternalLoginService => _externalLoginService?.Value;
+ public IExternalLoginService? ExternalLoginService => _externalLoginService?.Value;
///
/// Gets the RedirectUrlService.
@@ -257,7 +257,7 @@ public class ServiceContext
IDomainService? domainService = null,
IMacroService? macroService = null,
IPublicAccessService? publicAccessService = null,
- IExternalLoginWithKeyService? externalLoginService = null,
+ IExternalLoginService? externalLoginService = null,
IServerRegistrationService? serverRegistrationService = null,
IRedirectUrlService? redirectUrlService = null,
IConsentService? consentService = null,
diff --git a/src/Umbraco.Core/Services/TwoFactorLoginService.cs b/src/Umbraco.Core/Services/TwoFactorLoginService.cs
index acbdded1c9..de79284ac9 100644
--- a/src/Umbraco.Core/Services/TwoFactorLoginService.cs
+++ b/src/Umbraco.Core/Services/TwoFactorLoginService.cs
@@ -11,7 +11,7 @@ using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.Services;
///
-public class TwoFactorLoginService : ITwoFactorLoginService
+public class TwoFactorLoginService : ITwoFactorLoginService2
{
private readonly IOptions _backOfficeIdentityOptions;
private readonly IOptions _identityOptions;
@@ -39,6 +39,23 @@ public class TwoFactorLoginService : ITwoFactorLoginService
_twoFactorSetupGenerators = twoFactorSetupGenerators.ToDictionary(x => x.ProviderName);
}
+ [Obsolete("Use ctor with all params - This will be removed in v11")]
+ public TwoFactorLoginService(
+ ITwoFactorLoginRepository twoFactorLoginRepository,
+ ICoreScopeProvider scopeProvider,
+ IEnumerable twoFactorSetupGenerators,
+ IOptions identityOptions,
+ IOptions backOfficeIdentityOptions)
+ : this(
+ twoFactorLoginRepository,
+ scopeProvider,
+ twoFactorSetupGenerators,
+ identityOptions,
+ backOfficeIdentityOptions,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
///
public async Task DeleteUserLoginsAsync(Guid userOrMemberKey)
{
diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs
index 69e6351fbd..88e2708b2c 100644
--- a/src/Umbraco.Core/Services/UserService.cs
+++ b/src/Umbraco.Core/Services/UserService.cs
@@ -333,8 +333,13 @@ internal class UserService : RepositoryService, IUserService
}
}
+ // explicit implementation because we don't need it now but due to the way that the members membership provider is put together
+ // this method must exist in this service as an implementation (legacy)
+ void IMembershipMemberService.SetLastLogin(string username, DateTime date) => _logger.LogWarning(
+ "This method is not implemented. Using membership providers users is not advised, use ASP.NET Identity instead. See issue #9224 for more information.");
+
///
- /// Saves an
+ /// Saves an
///
/// to Save
public void Save(IUser entity)
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 8ee0b780b0..01183739d5 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Umbraco.Cms.Core
Umbraco CMS
Umbraco.Cms.Core
@@ -15,15 +15,6 @@
-
-
-
-
-
-
-
-
-
@@ -39,7 +30,7 @@
-
+
all
diff --git a/src/Umbraco.Core/Web/IRequestAccessor.cs b/src/Umbraco.Core/Web/IRequestAccessor.cs
index 57940b3c1b..a72ec5bc72 100644
--- a/src/Umbraco.Core/Web/IRequestAccessor.cs
+++ b/src/Umbraco.Core/Web/IRequestAccessor.cs
@@ -5,12 +5,12 @@ public interface IRequestAccessor
///
/// Returns the request/form/querystring value for the given name
///
- string? GetRequestValue(string name);
+ string GetRequestValue(string name);
///
/// Returns the query string value for the given name
///
- string? GetQueryStringValue(string name);
+ string GetQueryStringValue(string name);
///
/// Returns the current request uri
diff --git a/src/Umbraco.Core/WebAssets/IRuntimeMinifier.cs b/src/Umbraco.Core/WebAssets/IRuntimeMinifier.cs
index 813618738b..c6116e122f 100644
--- a/src/Umbraco.Core/WebAssets/IRuntimeMinifier.cs
+++ b/src/Umbraco.Core/WebAssets/IRuntimeMinifier.cs
@@ -1,34 +1,34 @@
namespace Umbraco.Cms.Core.WebAssets;
///
-/// Used for bundling and minifying web assets at runtime
+/// Used for bundling and minifying web assets at runtime
///
public interface IRuntimeMinifier
{
///
- /// Returns the cache buster value
+ /// Returns the cache buster value
///
string CacheBuster { get; }
///
- /// Creates a css bundle
+ /// Creates a css bundle
///
///
///
///
- /// All files must be absolute paths, relative paths will throw
+ /// All files must be absolute paths, relative paths will throw
///
///
- /// Thrown if any of the paths specified are not absolute
+ /// Thrown if any of the paths specified are not absolute
///
void CreateCssBundle(string bundleName, BundlingOptions bundleOptions, params string[]? filePaths);
///
- /// Renders the html link tag for the bundle
+ /// Renders the html link tag for the bundle
///
///
///
- /// An html encoded string
+ /// An html encoded string
///
Task RenderCssHereAsync(string bundleName);
@@ -39,45 +39,63 @@ public interface IRuntimeMinifier
///
///
///
- /// All files must be absolute paths, relative paths will throw
+ /// All files must be absolute paths, relative paths will throw
///
///
- /// Thrown if any of the paths specified are not absolute
+ /// Thrown if any of the paths specified are not absolute
///
void CreateJsBundle(string bundleName, BundlingOptions bundleOptions, params string[]? filePaths);
///
- /// Renders the html script tag for the bundle
+ /// Renders the html script tag for the bundle
///
///
///
- /// An html encoded string
+ /// An html encoded string
///
Task RenderJsHereAsync(string bundleName);
///
- /// Returns the asset paths for the JS bundle name
+ /// Returns the asset paths for the JS bundle name
///
///
///
- /// If debug mode is enabled this will return all asset paths (not bundled), else it will return a bundle URL
+ /// If debug mode is enabled this will return all asset paths (not bundled), else it will return a bundle URL
///
Task> GetJsAssetPathsAsync(string bundleName);
///
- /// Returns the asset paths for the css bundle name
+ /// Returns the asset paths for the css bundle name
///
///
///
- /// If debug mode is enabled this will return all asset paths (not bundled), else it will return a bundle URL
+ /// If debug mode is enabled this will return all asset paths (not bundled), else it will return a bundle URL
///
Task> GetCssAssetPathsAsync(string bundleName);
///
- /// Minify the file content, of a given type
+ /// Minify the file content, of a given type
///
///
///
///
Task MinifyAsync(string? fileContent, AssetType assetType);
+
+ ///
+ /// Ensures that all runtime minifications are refreshed on next request. E.g. Clearing cache.
+ ///
+ ///
+ ///
+ /// No longer necessary, invalidation occurs automatically if any of the following occur.
+ ///
+ ///
+ /// - Your sites assembly information version changes.
+ /// - Umbraco.Cms.Core assembly information version changes.
+ /// - RuntimeMinificationSettings Version string changes.
+ ///
+ /// for further
+ /// details.
+ ///
+ [Obsolete("Invalidation is handled automatically. Scheduled for removal V11.")]
+ void Reset();
}
diff --git a/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs b/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
index f7c3cf9a3e..e6306ab444 100644
--- a/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
+++ b/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
@@ -25,7 +25,7 @@ public sealed class ConfigureIndexOptions : IConfigureNamedOptions
- net7.0
+ net6.0
Umbraco.Cms.Infrastructure.Examine
Umbraco CMS
Umbraco.Examine.Lucene
diff --git a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
index 1e17b959b6..6d583151ba 100644
--- a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
+++ b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
@@ -19,6 +19,11 @@ namespace Umbraco.Cms.Core.Configuration
private readonly ILogger _logger;
private readonly object _locker = new object();
+ [Obsolete]
+ public JsonConfigManipulator(IConfiguration configuration)
+ : this(configuration, StaticServiceProvider.Instance.GetRequiredService>())
+ { }
+
public JsonConfigManipulator(IConfiguration configuration, ILogger logger)
{
_configuration = configuration;
@@ -229,7 +234,7 @@ namespace Umbraco.Cms.Core.Configuration
{
if (provider.Source.FileProvider is PhysicalFileProvider physicalFileProvider)
{
- var jsonFilePath = Path.Combine(physicalFileProvider.Root, provider.Source.Path!);
+ var jsonFilePath = Path.Combine(physicalFileProvider.Root, provider.Source.Path);
try
{
@@ -264,7 +269,7 @@ namespace Umbraco.Cms.Core.Configuration
return null;
}
- var jsonFilePath = Path.Combine(physicalFileProvider.Root, provider.Source.Path!);
+ var jsonFilePath = Path.Combine(physicalFileProvider.Root, provider.Source.Path);
try
{
diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
index 3afb9fe64a..8b20a4725a 100644
--- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
+++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
@@ -32,7 +32,8 @@ public static partial class UmbracoBuilderExtensions
builder.Services.AddUnique();
builder.Services.AddMultipleUnique();
builder.Services.AddUnique();
- builder.Services.AddSingleton();
+ builder.Services.AddUnique();
+ builder.Services.AddUnique(factory => factory.GetRequiredService());
builder.Services.AddUnique(factory => factory.GetRequiredService());
builder.Services.AddUnique();
builder.Services.AddUnique();
diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs
index a08c5f1b59..68b311f8cd 100644
--- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs
+++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs
@@ -45,6 +45,13 @@ public abstract class RecurringHostedServiceBase : IHostedService, IDisposable
_delay = delay;
}
+ // Scheduled for removal in V11
+ [Obsolete("Please use constructor that takes an ILogger instead")]
+ protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay)
+ : this(null, period, delay)
+ {
+ }
+
///
public void Dispose()
{
diff --git a/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs b/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs
index d4a6265052..bd69c7857c 100644
--- a/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs
+++ b/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs
@@ -40,11 +40,21 @@ public class ReportSiteTask : RecurringHostedServiceBase
{
}
- ///
- /// Runs the background task to send the anonymous ID
- /// to telemetry service
- ///
- public override async Task PerformExecuteAsync(object? state){
+ [Obsolete("Use the constructor that takes ITelemetryService instead, scheduled for removal in V11")]
+ public ReportSiteTask(
+ ILogger logger,
+ IUmbracoVersion umbracoVersion,
+ IOptions globalSettings)
+ : this(logger, StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
+ ///
+ /// Runs the background task to send the anonymous ID
+ /// to telemetry service
+ ///
+ public override async Task PerformExecuteAsync(object? state)
+ {
if (_runtimeState.Level is not RuntimeLevel.Run)
{
// We probably haven't installed yet, so we can't get telemetry.
diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs
index 3fc763d92f..df1457d419 100644
--- a/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs
+++ b/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs
@@ -1,4 +1,4 @@
-using Umbraco.Cms.Core.Models;
+using Umbraco.Cms.Core.Models;
namespace Umbraco.Cms.Core.Logging.Viewer;
@@ -39,6 +39,13 @@ public interface ILogViewer
bool CheckCanOpenLogs(LogTimePeriod logTimePeriod);
+ ///
+ /// Gets the current Serilog minimum log level
+ ///
+ ///
+ [Obsolete("Please use GetLogLevels() instead. Scheduled for removal in V11.")]
+ string GetLogLevel();
+
///
/// Returns the collection of logs
///
diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs
index 56efba4ca9..9dae731af3 100644
--- a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs
+++ b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs
@@ -1,4 +1,4 @@
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Serilog.Events;
@@ -14,6 +14,14 @@ public abstract class SerilogLogViewerSourceBase : ILogViewer
private readonly ILogViewerConfig _logViewerConfig;
private readonly ILogger _serilogLog;
+ [Obsolete("Please use ctor with all params instead. Scheduled for removal in V11.")]
+ protected SerilogLogViewerSourceBase(ILogViewerConfig logViewerConfig, ILogger serilogLog)
+ {
+ _logViewerConfig = logViewerConfig;
+ _logLevelLoader = StaticServiceProvider.Instance.GetRequiredService();
+ _serilogLog = serilogLog;
+ }
+
protected SerilogLogViewerSourceBase(ILogViewerConfig logViewerConfig, ILogLevelLoader logLevelLoader, ILogger serilogLog)
{
_logViewerConfig = logViewerConfig;
@@ -41,6 +49,17 @@ public abstract class SerilogLogViewerSourceBase : ILogViewer
return errorCounter.Count;
}
+ ///
+ /// Get the Serilog minimum-level value from the config file.
+ ///
+ [Obsolete("Please use LogLevelLoader.GetGlobalMinLogLevel() instead. Scheduled for removal in V11.")]
+ public string GetLogLevel()
+ {
+ LogEventLevel? logLevel = Enum.GetValues(typeof(LogEventLevel)).Cast()
+ .Where(_serilogLog.IsEnabled).DefaultIfEmpty(LogEventLevel.Information).Min();
+ return logLevel?.ToString() ?? string.Empty;
+ }
+
public LogLevelCounts GetLogLevelCounts(LogTimePeriod logTimePeriod)
{
var counter = new CountingFilter();
diff --git a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
index 8c1e0e2a54..3f12fd7d0d 100644
--- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
@@ -12,6 +12,7 @@ using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax;
+using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;
using ColumnInfo = Umbraco.Cms.Infrastructure.Persistence.SqlSyntax.ColumnInfo;
@@ -92,20 +93,32 @@ public class DatabaseSchemaCreator
private readonly ILoggerFactory _loggerFactory;
private readonly IUmbracoVersion _umbracoVersion;
- public DatabaseSchemaCreator(
- IUmbracoDatabase? database,
- ILogger logger,
- ILoggerFactory loggerFactory,
- IUmbracoVersion umbracoVersion,
- IEventAggregator eventAggregator,
- IOptionsMonitor defaultDataCreationSettings)
- {
- _database = database ?? throw new ArgumentNullException(nameof(database));
- _logger = logger ?? throw new ArgumentNullException(nameof(logger));
- _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
- _umbracoVersion = umbracoVersion ?? throw new ArgumentNullException(nameof(umbracoVersion));
- _eventAggregator = eventAggregator;
- _defaultDataCreationSettings = defaultDataCreationSettings;
+ [Obsolete("Please use constructor taking all parameters. Scheduled for removal in V11.")]
+ public DatabaseSchemaCreator(
+ IUmbracoDatabase? database,
+ ILogger logger,
+ ILoggerFactory loggerFactory,
+ IUmbracoVersion umbracoVersion,
+ IEventAggregator eventAggregator)
+ : this(database, logger, loggerFactory, umbracoVersion, eventAggregator,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
+ public DatabaseSchemaCreator(
+ IUmbracoDatabase? database,
+ ILogger logger,
+ ILoggerFactory loggerFactory,
+ IUmbracoVersion umbracoVersion,
+ IEventAggregator eventAggregator,
+ IOptionsMonitor defaultDataCreationSettings)
+ {
+ _database = database ?? throw new ArgumentNullException(nameof(database));
+ _logger = logger ?? throw new ArgumentNullException(nameof(logger));
+ _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
+ _umbracoVersion = umbracoVersion ?? throw new ArgumentNullException(nameof(umbracoVersion));
+ _eventAggregator = eventAggregator;
+ _defaultDataCreationSettings = defaultDataCreationSettings;
if (_database?.SqlContext?.SqlSyntax == null)
{
diff --git a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs
index 860ed870f7..6c28f08eb6 100644
--- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs
@@ -1,9 +1,11 @@
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Infrastructure.Persistence;
+using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Infrastructure.Migrations.Install;
@@ -18,19 +20,30 @@ public class DatabaseSchemaCreatorFactory
private readonly ILoggerFactory _loggerFactory;
private readonly IUmbracoVersion _umbracoVersion;
- public DatabaseSchemaCreatorFactory(
- ILogger logger,
- ILoggerFactory loggerFactory,
- IUmbracoVersion umbracoVersion,
- IEventAggregator eventAggregator,
- IOptionsMonitor installDefaultDataSettings)
- {
- _logger = logger;
- _loggerFactory = loggerFactory;
- _umbracoVersion = umbracoVersion;
- _eventAggregator = eventAggregator;
- _installDefaultDataSettings = installDefaultDataSettings;
- }
+ [Obsolete("Please use the constructor taking all parameters. Scheduled for removal in V11.")]
+ public DatabaseSchemaCreatorFactory(
+ ILogger logger,
+ ILoggerFactory loggerFactory,
+ IUmbracoVersion umbracoVersion,
+ IEventAggregator eventAggregator)
+ : this(logger, loggerFactory, umbracoVersion, eventAggregator,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
+ public DatabaseSchemaCreatorFactory(
+ ILogger logger,
+ ILoggerFactory loggerFactory,
+ IUmbracoVersion umbracoVersion,
+ IEventAggregator eventAggregator,
+ IOptionsMonitor installDefaultDataSettings)
+ {
+ _logger = logger;
+ _loggerFactory = loggerFactory;
+ _umbracoVersion = umbracoVersion;
+ _eventAggregator = eventAggregator;
+ _installDefaultDataSettings = installDefaultDataSettings;
+ }
public DatabaseSchemaCreator Create(IUmbracoDatabase? database) => new DatabaseSchemaCreator(database, _logger,
_loggerFactory, _umbracoVersion, _eventAggregator, _installDefaultDataSettings);
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
index f1369db5c3..6e5e462d8d 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
@@ -84,9 +84,17 @@ public class AddTypedLabels : MigrationBase
.From()
.Where(x => x.DataTypeId == Constants.DataTypes.LabelString));
- var intPropertyAliases = new[] { Cms.Core.Constants.Conventions.Media.Width, Cms.Core.Constants.Conventions.Media.Height, "umbracoMemberFailedPasswordAttempts" };
- var bigintPropertyAliases = new[] { Cms.Core.Constants.Conventions.Media.Bytes };
- var dtPropertyAliases = new[] { "umbracoMemberLastLockoutDate", "umbracoMemberLastLogin", "umbracoMemberLastPasswordChangeDate" };
+ var intPropertyAliases = new[]
+ {
+ Constants.Conventions.Media.Width, Constants.Conventions.Media.Height,
+ Constants.Conventions.Member.FailedPasswordAttempts,
+ };
+ var bigintPropertyAliases = new[] { Constants.Conventions.Media.Bytes };
+ var dtPropertyAliases = new[]
+ {
+ Constants.Conventions.Member.LastLockoutDate, Constants.Conventions.Member.LastLoginDate,
+ Constants.Conventions.Member.LastPasswordChangeDate,
+ };
var intPropertyTypes = labelPropertyTypes.Where(pt => intPropertyAliases.Contains(pt.Alias)).Select(pt => pt.Id)
.ToArray();
diff --git a/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs b/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
index 3e3c2cfae1..cec42492a3 100644
--- a/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
+++ b/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
@@ -1,5 +1,3 @@
-using Microsoft.Extensions.Options;
-using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Packaging;
using Umbraco.Cms.Core.PropertyEditors;
@@ -44,8 +42,8 @@ public abstract class AutomaticPackageMigrationPlan : PackageMigrationPlan
MediaUrlGeneratorCollection mediaUrlGenerators,
IShortStringHelper shortStringHelper,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
- IMigrationContext context, IOptions options)
- : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context, options)
+ IMigrationContext context)
+ : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context)
{
}
diff --git a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs
index 192d1a51c3..b4f49ab76b 100644
--- a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs
+++ b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs
@@ -906,7 +906,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
UpdateContentTypesPropertyGroups(contentType, documentType.Element("Tabs"));
UpdateContentTypesProperties(contentType, documentType.Element("GenericProperties"));
- if (contentType is IContentType withCleanup)
+ if (contentType is IContentTypeWithHistoryCleanup withCleanup)
{
UpdateHistoryCleanupPolicy(withCleanup, documentType.Element("HistoryCleanupPolicy"));
}
@@ -914,7 +914,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
return contentType;
}
- private void UpdateHistoryCleanupPolicy(IContentType withCleanup, XElement? element)
+ private void UpdateHistoryCleanupPolicy(IContentTypeWithHistoryCleanup withCleanup, XElement? element)
{
if (element == null)
{
diff --git a/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs b/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
index 6f0355f674..ae739c4361 100644
--- a/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
+++ b/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
@@ -1,3 +1,5 @@
+using System.ComponentModel;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.IO;
@@ -5,6 +7,7 @@ using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Infrastructure.Migrations;
+using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Infrastructure.Packaging;
@@ -38,16 +41,36 @@ public abstract class PackageMigrationBase : MigrationBase
_packageMigrationsSettings = packageMigrationsSettings;
}
- public IImportPackageBuilder ImportPackage => BeginBuild(
- new ImportPackageBuilder(
- _packagingService,
- _mediaService,
- _mediaFileManager,
- _mediaUrlGenerators,
- _shortStringHelper,
- _contentTypeBaseServiceProvider,
- Context,
- _packageMigrationsSettings));
-
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Use ctor with all params")]
+ public PackageMigrationBase(
+ IPackagingService packagingService,
+ IMediaService mediaService,
+ MediaFileManager mediaFileManager,
+ MediaUrlGeneratorCollection mediaUrlGenerators,
+ IShortStringHelper shortStringHelper,
+ IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
+ IMigrationContext context)
+ : this(
+ packagingService,
+ mediaService,
+ mediaFileManager,
+ mediaUrlGenerators,
+ shortStringHelper,
+ contentTypeBaseServiceProvider,
+ context,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+ public IImportPackageBuilder ImportPackage => BeginBuild(
+ new ImportPackageBuilder(
+ _packagingService,
+ _mediaService,
+ _mediaFileManager,
+ _mediaUrlGenerators,
+ _shortStringHelper,
+ _contentTypeBaseServiceProvider,
+ Context,
+ _packageMigrationsSettings));
}
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs
index 9e35999071..fd7193e4ae 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs
@@ -299,7 +299,7 @@ internal class ContentTypeRepository : ContentTypeRepositoryBase,
{
// historyCleanup property is not mandatory for api endpoint, handle the case where it's not present.
// DocumentTypeSave doesn't handle this for us like ContentType constructors do.
- if (entity is IContentType entityWithHistoryCleanup)
+ if (entity is IContentTypeWithHistoryCleanup entityWithHistoryCleanup)
{
var dto = new ContentVersionCleanupPolicyDto
{
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs
index e49e2ffda9..2207bdb16e 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs
@@ -14,13 +14,26 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
-internal class ExternalLoginRepository : EntityRepositoryBase, IExternalLoginWithKeyRepository
+internal class ExternalLoginRepository : EntityRepositoryBase, IExternalLoginRepository, IExternalLoginWithKeyRepository
{
public ExternalLoginRepository(IScopeAccessor scopeAccessor, AppCaches cache,
ILogger logger)
: base(scopeAccessor, cache, logger)
{
}
+
+ ///
+ [Obsolete("Use method that takes guid as param")]
+ public void DeleteUserLogins(int memberId) => DeleteUserLogins(memberId.ToGuid());
+
+ ///
+ [Obsolete("Use method that takes guid as param")]
+ public void Save(int userId, IEnumerable logins) => Save(userId.ToGuid(), logins);
+
+ ///
+ [Obsolete("Use method that takes guid as param")]
+ public void Save(int userId, IEnumerable tokens) => Save(userId.ToGuid(), tokens);
+
///
/// Query for user tokens
///
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MacroRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MacroRepository.cs
index 67fe818358..323238084f 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MacroRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MacroRepository.cs
@@ -15,7 +15,7 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
-internal class MacroRepository : EntityRepositoryBase, IMacroRepository
+internal class MacroRepository : EntityRepositoryBase, IMacroWithAliasRepository
{
private readonly IRepositoryCachePolicy _macroByAliasCachePolicy;
private readonly IShortStringHelper _shortStringHelper;
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs
index 200af7ad70..02d1383bc3 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs
@@ -202,6 +202,13 @@ public class MemberRepository : ContentRepositoryBase(fullSql);
}
+ ///
+ [Obsolete(
+ "This is now a NoOp since last login date is no longer an umbraco property, set the date on the IMember directly and Save it instead, scheduled for removal in V11.")]
+ public void SetLastLogin(string username, DateTime date)
+ {
+ }
+
///
/// Gets paged member results.
///
diff --git a/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs b/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
index 86eba639ce..76eeb33821 100644
--- a/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
+++ b/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
@@ -169,9 +169,12 @@ public class CoreRuntime : IRuntime
// Acquire the main domain - if this fails then anything that should be registered with MainDom will not operate
AcquireMainDom();
+ // TODO (V10): Remove this obsoleted notification publish.
+ await _eventAggregator.PublishAsync(new UmbracoApplicationMainDomAcquiredNotification(), cancellationToken);
+
// Notify for unattended install
- await _eventAggregator.PublishAsync(new RuntimeUnattendedInstallNotification(), cancellationToken);
- DetermineRuntimeLevel();
+ await _eventAggregator.PublishAsync(new RuntimeUnattendedInstallNotification(), cancellationToken);
+ DetermineRuntimeLevel();
if (!State.UmbracoCanBoot())
{
@@ -209,8 +212,13 @@ public class CoreRuntime : IRuntime
break;
}
+ // TODO (V10): Remove this obsoleted notification publish
+ await _eventAggregator.PublishAsync(
+ new UmbracoApplicationComponentsInstallingNotification(State.Level),
+ cancellationToken);
+
// Initialize the components
- _components.Initialize();
+ _components.Initialize();
await _eventAggregator.PublishAsync(
new UmbracoApplicationStartingNotification(State.Level, isRestarting),
diff --git a/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs b/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
index a6589166b2..9555482bbf 100644
--- a/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
@@ -46,12 +46,12 @@ public class BackOfficeClaimsPrincipalFactory : UserClaimsPrincipalFactory x.RoleId).ToArray());
diff --git a/src/Umbraco.Infrastructure/Security/BackOfficeErrorDescriber.cs b/src/Umbraco.Infrastructure/Security/BackOfficeErrorDescriber.cs
index b99eddba5d..2b9daab29f 100644
--- a/src/Umbraco.Infrastructure/Security/BackOfficeErrorDescriber.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeErrorDescriber.cs
@@ -20,7 +20,7 @@ public class BackOfficeErrorDescriber : UmbracoErrorDescriberBase
Description = _textService.Localize("validation", "duplicateUserGroupName", new[] { role }),
};
- public override IdentityError InvalidRoleName(string? role) => new()
+ public override IdentityError InvalidRoleName(string role) => new()
{
Code = nameof(InvalidRoleName),
Description = _textService.Localize("validation", "invalidUserGroupName"),
@@ -70,7 +70,7 @@ public class MembersErrorDescriber : UmbracoErrorDescriberBase
Description = _textService.Localize("validation", "duplicateMemberGroupName", new[] { role }),
};
- public override IdentityError InvalidRoleName(string? role) => new()
+ public override IdentityError InvalidRoleName(string role) => new()
{
Code = nameof(InvalidRoleName),
Description = _textService.Localize("validation", "invalidMemberGroupName"),
diff --git a/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
index 1908a3fbfc..244885887e 100644
--- a/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
@@ -81,6 +81,29 @@ public class BackOfficeUserStore : UmbracoUserStore globalSettings,
+ IUmbracoMapper mapper,
+ BackOfficeErrorDescriber describer,
+ AppCaches appCaches)
+ : this(
+ scopeProvider,
+ userService,
+ entityService,
+ StaticServiceProvider.Instance.GetRequiredService(),
+ StaticServiceProvider.Instance.GetRequiredService>(),
+ mapper,
+ describer,
+ appCaches,
+ StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
///
public Task ValidateSessionIdAsync(string? userId, string? sessionId)
{
@@ -117,17 +140,12 @@ public class BackOfficeUserStore : UmbracoUserStore();
- var emptyPasswordValue = Constants.Security.EmptyPasswordPrefix +
+ // the password must be 'something' it could be empty if authenticating
+ // with an external provider so we'll just generate one and prefix it, the
+ // prefix will help us determine if the password hasn't actually been specified yet.
+ // this will hash the guid with a salt so should be nicely random
+ var aspHasher = new PasswordHasher();
+ var emptyPasswordValue = Constants.Security.EmptyPasswordPrefix +
aspHasher.HashPassword(user, Guid.NewGuid().ToString("N"));
var userEntity = new User(_globalSettings, user.Name, user.Email, user.UserName, emptyPasswordValue)
@@ -260,14 +278,16 @@ public class BackOfficeUserStore : UmbracoUserStore
- public override Task FindByNameAsync(string userName, CancellationToken cancellationToken = default)
+ public override Task FindByNameAsync(
+ string userName,
+ CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
IUser? user = _userService.GetByUsername(userName);
if (user == null)
{
- return Task.FromResult(null);
+ return Task.FromResult((BackOfficeIdentityUser)null!);
}
BackOfficeIdentityUser? result = AssignLoginsCallback(_mapper.Map(user));
@@ -276,7 +296,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
+ protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -291,7 +311,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- public override Task FindByEmailAsync(
+ public override Task FindByEmailAsync(
string email,
CancellationToken cancellationToken = default)
{
@@ -302,11 +322,11 @@ public class BackOfficeUserStore : UmbracoUserStore(user);
- return Task.FromResult(AssignLoginsCallback(result));
+ return Task.FromResult(AssignLoginsCallback(result))!;
}
///
- public override async Task SetPasswordHashAsync(BackOfficeIdentityUser user, string? passwordHash, CancellationToken cancellationToken = default)
+ public override async Task SetPasswordHashAsync(BackOfficeIdentityUser user, string passwordHash, CancellationToken cancellationToken = default)
{
await base.SetPasswordHashAsync(user, passwordHash, cancellationToken);
@@ -408,7 +428,7 @@ public class BackOfficeUserStore : UmbracoUserStore
///
- public override Task SetTokenAsync(BackOfficeIdentityUser user, string loginProvider, string name, string? value, CancellationToken cancellationToken)
+ public override Task SetTokenAsync(BackOfficeIdentityUser user, string loginProvider, string name, string value, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -440,15 +460,15 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override async Task?> FindUserLoginAsync(string userId, string loginProvider, string providerKey, CancellationToken cancellationToken)
+ protected override async Task> FindUserLoginAsync(string userId, string loginProvider, string providerKey, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
- BackOfficeIdentityUser? user = await FindUserAsync(userId, cancellationToken);
- if (user?.Id is null)
+ BackOfficeIdentityUser user = await FindUserAsync(userId, cancellationToken);
+ if (user is null || user.Id is null)
{
- return null;
+ return null!;
}
IList logins = await GetLoginsAsync(user, cancellationToken);
@@ -456,7 +476,7 @@ public class BackOfficeUserStore : UmbracoUserStore x.ProviderKey == providerKey && x.LoginProvider == loginProvider);
if (found == null)
{
- return null;
+ return null!;
}
return new IdentityUserLogin
@@ -469,7 +489,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override Task?> FindUserLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken)
+ protected override Task> FindUserLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -477,11 +497,11 @@ public class BackOfficeUserStore : UmbracoUserStore?>(null);
+ return Task.FromResult((IdentityUserLogin)null!);
}
IIdentityUserLogin found = logins[0];
- return Task.FromResult?>(new IdentityUserLogin
+ return Task.FromResult(new IdentityUserLogin
{
LoginProvider = found.LoginProvider,
ProviderKey = found.ProviderKey,
@@ -491,33 +511,30 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override Task?> FindRoleAsync(
+ protected override Task> FindRoleAsync(
string normalizedRoleName,
CancellationToken cancellationToken)
{
IUserGroup? group = _userService.GetUserGroupByAlias(normalizedRoleName);
- if (group?.Name is null)
+ if (group == null)
{
- return Task.FromResult?>(null);
+ return Task.FromResult((IdentityRole)null!);
}
- return Task.FromResult?>(new IdentityRole(group.Name)
- {
- Id = group.Alias,
- });
+ return Task.FromResult(new IdentityRole(group.Name) { Id = group.Alias });
}
///
- protected override async Task?> FindUserRoleAsync(string userId, string roleId, CancellationToken cancellationToken)
+ protected override async Task> FindUserRoleAsync(string userId, string roleId, CancellationToken cancellationToken)
{
- BackOfficeIdentityUser? user = await FindUserAsync(userId, cancellationToken);
+ BackOfficeIdentityUser user = await FindUserAsync(userId, cancellationToken);
if (user == null)
{
return null!;
}
IdentityUserRole? found = user.Roles.FirstOrDefault(x => x.RoleId.InvariantEquals(roleId));
- return found;
+ return found!;
}
private BackOfficeIdentityUser? AssignLoginsCallback(BackOfficeIdentityUser? user)
@@ -589,7 +606,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- /// Overridden to support Umbraco's own data storage requirements
+ /// Overridden to support Umbraco's own data storage requirements
///
///
- /// The base class's implementation of this calls into FindTokenAsync, RemoveUserTokenAsync and AddUserTokenAsync, both methods will only work with ORMs that are change
- /// tracking ORMs like EFCore.
+ /// The base class's implementation of this calls into FindTokenAsync, RemoveUserTokenAsync and AddUserTokenAsync, both
+ /// methods will only work with ORMs that are change
+ /// tracking ORMs like EFCore.
///
///
public override Task RemoveTokenAsync(BackOfficeIdentityUser user, string loginProvider, string name, CancellationToken cancellationToken)
diff --git a/src/Umbraco.Infrastructure/Security/ClaimsIdentityExtensions.cs b/src/Umbraco.Infrastructure/Security/ClaimsIdentityExtensions.cs
index c914930e9e..05ab03b784 100644
--- a/src/Umbraco.Infrastructure/Security/ClaimsIdentityExtensions.cs
+++ b/src/Umbraco.Infrastructure/Security/ClaimsIdentityExtensions.cs
@@ -38,9 +38,9 @@ public static class MergeClaimsIdentityExtensions
{
foreach (IdentityUserClaim claim in source.Claims
.Where(claim => !_ignoredClaims.Contains(claim.ClaimType))
- .Where(claim => !destination.HasClaim(claim.ClaimType!, claim.ClaimValue!)))
+ .Where(claim => !destination.HasClaim(claim.ClaimType, claim.ClaimValue)))
{
- destination.AddClaim(new Claim(claim.ClaimType!, claim.ClaimValue!));
+ destination.AddClaim(new Claim(claim.ClaimType, claim.ClaimValue));
}
}
}
diff --git a/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs b/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
index 714db070bb..fe34812334 100644
--- a/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
+++ b/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
@@ -22,14 +22,14 @@ public interface IUmbracoUserManager : IDisposable
///
/// The
/// A representing the result of the asynchronous operation.
- Task GetUserAsync(ClaimsPrincipal principal);
+ Task GetUserAsync(ClaimsPrincipal principal);
///
/// Get the user id from the
///
/// the
/// Returns the user id from the
- string? GetUserId(ClaimsPrincipal principal);
+ string GetUserId(ClaimsPrincipal principal);
///
/// Gets the external logins for the user
@@ -47,7 +47,7 @@ public interface IUmbracoUserManager : IDisposable
/// Finds a user by the external login provider
///
/// A representing the result of the asynchronous operation.
- Task FindByLoginAsync(string loginProvider, string providerKey);
+ Task FindByLoginAsync(string loginProvider, string providerKey);
///
/// Finds and returns a user, if any, who has the specified .
@@ -57,7 +57,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the user matching the specified
/// if it exists.
///
- Task FindByIdAsync(string userId);
+ Task FindByIdAsync(string? userId);
///
/// Generates a password reset token for the specified , using
@@ -80,7 +80,7 @@ public interface IUmbracoUserManager : IDisposable
/// is to generate a token and reset it, however, when we do this we want to track a password change, not a password
/// reset
///
- Task ChangePasswordWithResetAsync(string userId, string token, string newPassword);
+ Task ChangePasswordWithResetAsync(string userId, string token, string? newPassword);
///
/// Validates that an email confirmation token matches the specified .
@@ -91,7 +91,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
- Task ConfirmEmailAsync(TUser user, string token);
+ Task ConfirmEmailAsync(TUser user, string? token);
///
/// Gets the user, if any, associated with the normalized value of the specified email address.
@@ -103,7 +103,7 @@ public interface IUmbracoUserManager : IDisposable
/// The task object containing the results of the asynchronous lookup operation, the user, if any, associated with a
/// normalized value of the specified email address.
///
- Task FindByEmailAsync(string email);
+ Task FindByEmailAsync(string email);
///
/// Resets the 's password to the specified after
@@ -116,7 +116,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
- Task ResetPasswordAsync(TUser user, string token, string newPassword);
+ Task ResetPasswordAsync(TUser user, string? token, string? newPassword);
///
/// Override to check the user approval value as well as the user lock out date, by default this only checks the user's
@@ -216,7 +216,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
- Task ChangePasswordAsync(TUser user, string currentPassword, string newPassword);
+ Task ChangePasswordAsync(TUser user, string? currentPassword, string? newPassword);
///
/// Used to validate a user's session
@@ -268,7 +268,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
- Task CreateAsync(TUser user, string password);
+ Task CreateAsync(TUser user, string? password);
///
/// Generate a password for a user based on the current password validator
@@ -302,7 +302,7 @@ public interface IUmbracoUserManager : IDisposable
/// The that represents the asynchronous operation, containing the user matching the specified
/// if it exists.
///
- Task FindByNameAsync(string userName);
+ Task FindByNameAsync(string userName);
///
/// Increments the access failed count for the user as an asynchronous operation.
@@ -373,7 +373,7 @@ public interface IUmbracoUserManager : IDisposable
/// The System.Threading.Tasks.Task that represents the asynchronous operation, containing the
/// Microsoft.AspNetCore.Identity.IdentityResult of the operation.
///
- Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey);
+ Task RemoveLoginAsync(TUser user, string? loginProvider, string? providerKey);
///
/// Resets the access failed count for the user
@@ -395,7 +395,7 @@ public interface IUmbracoUserManager : IDisposable
/// The task object containing the results of the asynchronous operation, the email address for the specified
/// user.
///
- Task GetEmailAsync(TUser user);
+ Task GetEmailAsync(TUser user);
///
/// Gets the telephone number, if any, for the specified user.
@@ -409,7 +409,7 @@ public interface IUmbracoUserManager : IDisposable
/// A user can only support a phone number if the BackOfficeUserStore is replaced with another that implements
/// IUserPhoneNumberStore
///
- Task GetPhoneNumberAsync(TUser user);
+ Task GetPhoneNumberAsync(TUser user);
///
/// Validates that a user's credentials are correct without actually logging them in.
diff --git a/src/Umbraco.Infrastructure/Security/MemberRoleStore.cs b/src/Umbraco.Infrastructure/Security/MemberRoleStore.cs
index b355bbcb18..eeeed4e4ec 100644
--- a/src/Umbraco.Infrastructure/Security/MemberRoleStore.cs
+++ b/src/Umbraco.Infrastructure/Security/MemberRoleStore.cs
@@ -131,7 +131,7 @@ public class MemberRoleStore : IQueryableRoleStore
}
///
- public Task GetRoleNameAsync(UmbracoIdentityRole role, CancellationToken cancellationToken = default)
+ public Task GetRoleNameAsync(UmbracoIdentityRole role, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -141,11 +141,11 @@ public class MemberRoleStore : IQueryableRoleStore
throw new ArgumentNullException(nameof(role));
}
- return Task.FromResult(role.Name);
+ return Task.FromResult(role.Name)!;
}
///
- public Task SetRoleNameAsync(UmbracoIdentityRole role, string? roleName,
+ public Task SetRoleNameAsync(UmbracoIdentityRole role, string roleName,
CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -155,24 +155,23 @@ public class MemberRoleStore : IQueryableRoleStore
throw new ArgumentNullException(nameof(role));
}
-
- role.Name = roleName;
- return Task.CompletedTask;
- }
+ role.Name = roleName;
+ return Task.CompletedTask;
+ }
///
- public Task GetNormalizedRoleNameAsync(
+ public Task GetNormalizedRoleNameAsync(
UmbracoIdentityRole role,
CancellationToken cancellationToken = default)
=> GetRoleNameAsync(role, cancellationToken);
///
- public Task SetNormalizedRoleNameAsync(UmbracoIdentityRole role, string? normalizedName,
+ public Task SetNormalizedRoleNameAsync(UmbracoIdentityRole role, string normalizedName,
CancellationToken cancellationToken = default)
=> SetRoleNameAsync(role, normalizedName, cancellationToken);
///
- public Task FindByIdAsync(string roleId, CancellationToken cancellationToken = default)
+ public Task FindByIdAsync(string roleId, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -186,37 +185,37 @@ public class MemberRoleStore : IQueryableRoleStore
// member group can be found by int or Guid, so try both
if (!int.TryParse(roleId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var id))
+ {
+ if (!Guid.TryParse(roleId, out Guid guid))
{
- if (!Guid.TryParse(roleId, out Guid guid))
- {
- throw new ArgumentOutOfRangeException(nameof(roleId), $"{nameof(roleId)} is not a valid Guid");
- }
+ throw new ArgumentOutOfRangeException(nameof(roleId), $"{nameof(roleId)} is not a valid Guid");
+ }
- memberGroup = _memberGroupService.GetById(guid);
+ memberGroup = _memberGroupService.GetById(guid);
}
else
{
memberGroup = _memberGroupService.GetById(id);
}
- return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup));
+ return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup))!;
}
///
- public Task FindByNameAsync(string name, CancellationToken cancellationToken = default)
+ public Task FindByNameAsync(string name, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
- if (string.IsNullOrWhiteSpace(name))
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- IMemberGroup? memberGroup = _memberGroupService.GetByName(name);
- return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup))!;
+ if (string.IsNullOrWhiteSpace(name))
+ {
+ throw new ArgumentNullException(nameof(name));
}
+ IMemberGroup? memberGroup = _memberGroupService.GetByName(name);
+ return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup))!;
+ }
+
///
/// Dispose the store
///
diff --git a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
index bd52d43d8b..70efeeb739 100644
--- a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
@@ -62,7 +62,7 @@ public class MemberUserStore : UmbracoUserStore(),
StaticServiceProvider.Instance.GetRequiredService())
@@ -91,7 +91,7 @@ public class MemberUserStore : UmbracoUserStore
- public override Task FindByNameAsync(string userName, CancellationToken cancellationToken = default)
+ public override Task FindByNameAsync(
+ string userName,
+ CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
IMember? user = _memberService.GetByUsername(userName);
if (user == null)
{
- return Task.FromResult(null);
+ return Task.FromResult((MemberIdentityUser)null!);
}
- MemberIdentityUser? result = AssignLoginsCallback(_mapper.Map(user))!;
+ MemberIdentityUser result = AssignLoginsCallback(_mapper.Map(user))!;
- return Task.FromResult(result);
+ return Task.FromResult(result);
}
public IPublishedContent? GetPublishedMember(MemberIdentityUser? user)
@@ -294,7 +296,7 @@ public class MemberUserStore : UmbracoUserStore
- public override Task FindByEmailAsync(
+ public override Task FindByEmailAsync(
string email,
CancellationToken cancellationToken = default)
{
@@ -305,11 +307,11 @@ public class MemberUserStore : UmbracoUserStore(member);
- return Task.FromResult(AssignLoginsCallback(result));
+ return Task.FromResult(AssignLoginsCallback(result))!;
}
///
- protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
+ protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -324,7 +326,7 @@ public class MemberUserStore : UmbracoUserStore(user)))!;
@@ -444,7 +446,7 @@ public class MemberUserStore : UmbracoUserStore
- protected override async Task?> FindUserLoginAsync(string userId, string loginProvider,
+ protected override async Task> FindUserLoginAsync(string userId, string loginProvider,
string providerKey, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -460,32 +462,38 @@ public class MemberUserStore : UmbracoUserStore?>(null);
+ return await Task.FromResult((IdentityUserLogin)null!);
}
IList logins = await GetLoginsAsync(user, cancellationToken);
UserLoginInfo? found =
logins.FirstOrDefault(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider);
- if (found is null)
+ if (found == null)
{
- return await Task.FromResult?>(null);
+ return await Task.FromResult((IdentityUserLogin)null!);
}
- return new IdentityUserLogin
+ if (user.Id is not null)
{
- LoginProvider = found.LoginProvider,
- ProviderKey = found.ProviderKey,
- // TODO: We don't store this value so it will be null
- ProviderDisplayName = found.ProviderDisplayName,
- UserId = user.Id
- };
+ return new IdentityUserLogin
+ {
+ LoginProvider = found.LoginProvider,
+ ProviderKey = found.ProviderKey,
+
+ // TODO: We don't store this value so it will be null
+ ProviderDisplayName = found.ProviderDisplayName,
+ UserId = user.Id,
+ };
+ }
+
+ return null!;
}
///
- protected override Task?> FindUserLoginAsync(string loginProvider, string providerKey,
+ protected override Task> FindUserLoginAsync(string loginProvider, string providerKey,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -504,11 +512,11 @@ public class MemberUserStore : UmbracoUserStore?>(null);
+ return Task.FromResult((IdentityUserLogin)null!);
}
IIdentityUserLogin found = logins[0];
- return Task.FromResult?>(new IdentityUserLogin
+ return Task.FromResult(new IdentityUserLogin
{
LoginProvider = found.LoginProvider,
ProviderKey = found.ProviderKey,
@@ -525,7 +533,7 @@ public class MemberUserStore : UmbracoUserStore currentRoles = _memberService.GetAllRoles(user.UserName!);
+ IEnumerable currentRoles = _memberService.GetAllRoles(user.UserName);
ICollection> roles = currentRoles
.Select(role => new IdentityUserRole { RoleId = role, UserId = user.Id }).ToList();
@@ -536,7 +544,7 @@ public class MemberUserStore : UmbracoUserStore
/// Lists all users of a given role.
///
- public override Task> GetUsersInRoleAsync(
+ public override Task?> GetUsersInRoleAsync(
string roleName,
CancellationToken cancellationToken = default)
{
@@ -548,10 +556,10 @@ public class MemberUserStore : UmbracoUserStore members = _memberService.GetMembersByMemberType(roleName);
+ IEnumerable? members = _memberService.GetMembersByMemberType(roleName);
- IList membersIdentityUsers =
- members.Select(x => _mapper.Map(x)!).ToList();
+ IList? membersIdentityUsers =
+ members?.Select(x => _mapper.Map(x)!).ToList();
return Task.FromResult(membersIdentityUsers);
}
@@ -565,7 +573,8 @@ public class MemberUserStore : UmbracoUserStore
///
- public override Task SetTokenAsync(MemberIdentityUser user, string loginProvider, string name, string? value, CancellationToken cancellationToken)
+ public override Task SetTokenAsync(MemberIdentityUser user, string loginProvider, string name, string value,
+ CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -623,7 +632,7 @@ public class MemberUserStore : UmbracoUserStore
- protected override Task FindRoleAsync(string roleName, CancellationToken cancellationToken)
+ protected override Task FindRoleAsync(string roleName, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(roleName))
{
@@ -631,12 +640,12 @@ public class MemberUserStore : UmbracoUserStore x.Name == roleName);
- if (group?.Name is null)
+ if (group == null)
{
- return Task.FromResult(null);
+ return Task.FromResult((UmbracoIdentityRole)null!);
}
- return Task.FromResult(new UmbracoIdentityRole(group.Name)
+ return Task.FromResult(new UmbracoIdentityRole(group.Name)
{
// TODO: what should the alias be?
Id = group.Id.ToString(),
@@ -644,25 +653,27 @@ public class MemberUserStore : UmbracoUserStore
- protected override async Task?> FindUserRoleAsync(string userId, string roleId,
+ protected override async Task> FindUserRoleAsync(string userId, string roleId,
CancellationToken cancellationToken)
{
- MemberIdentityUser? user = await FindUserAsync(userId, cancellationToken);
- if (user is null)
+ MemberIdentityUser user = await FindUserAsync(userId, cancellationToken);
+ if (user == null)
{
- return null;
+ return null!;
}
IdentityUserRole? found = user.Roles.FirstOrDefault(x => x.RoleId.InvariantEquals(roleId));
- return found;
+ return found!;
}
private MemberIdentityUser? AssignLoginsCallback(MemberIdentityUser? user)
{
- if (user is not null)
+ if (user != null)
{
- user.SetLoginsCallback(new Lazy?>(() => _externalLoginService.GetExternalLogins(user.Key)));
- user.SetTokensCallback(new Lazy?>(() => _externalLoginService.GetExternalLoginTokens(user.Key)));
+ user.SetLoginsCallback(
+ new Lazy?>(() => _externalLoginService.GetExternalLogins(user.Key)));
+ user.SetTokensCallback(new Lazy?>(() =>
+ _externalLoginService.GetExternalLoginTokens(user.Key)));
}
return user;
@@ -725,7 +736,7 @@ public class MemberUserStore : UmbracoUserStore
public class NoopLookupNormalizer : ILookupNormalizer
{
- public string? NormalizeName(string? name) => name;
+ public string NormalizeName(string name) => name;
- public string? NormalizeEmail(string? email) => email;
+ public string NormalizeEmail(string email) => email;
}
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoErrorDescriberBase.cs b/src/Umbraco.Infrastructure/Security/UmbracoErrorDescriberBase.cs
index ade4fd1515..671483fe7b 100644
--- a/src/Umbraco.Infrastructure/Security/UmbracoErrorDescriberBase.cs
+++ b/src/Umbraco.Infrastructure/Security/UmbracoErrorDescriberBase.cs
@@ -34,7 +34,7 @@ public abstract class UmbracoErrorDescriberBase : IdentityErrorDescriber
Description = _textService.Localize("validation", "duplicateUsername", new[] { userName }),
};
- public override IdentityError InvalidEmail(string? email) => new()
+ public override IdentityError InvalidEmail(string email) => new()
{
Code = nameof(InvalidEmail),
Description = _textService.Localize("validation", "invalidEmail"),
@@ -46,7 +46,7 @@ public abstract class UmbracoErrorDescriberBase : IdentityErrorDescriber
Description = _textService.Localize("validation", "invalidToken"),
};
- public override IdentityError InvalidUserName(string? userName) => new()
+ public override IdentityError InvalidUserName(string userName) => new()
{
Code = nameof(InvalidUserName),
Description = _textService.Localize("validation", "invalidUsername"),
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoIdentityRole.cs b/src/Umbraco.Infrastructure/Security/UmbracoIdentityRole.cs
index af6e745f46..e38a0b89ab 100644
--- a/src/Umbraco.Infrastructure/Security/UmbracoIdentityRole.cs
+++ b/src/Umbraco.Infrastructure/Security/UmbracoIdentityRole.cs
@@ -6,10 +6,10 @@ namespace Umbraco.Cms.Core.Security;
public class UmbracoIdentityRole : IdentityRole, IRememberBeingDirty
{
- private string _id = string.Empty;
- private string _name = string.Empty;
+ private string? _id;
+ private string? _name;
- public UmbracoIdentityRole(string roleName)
+ public UmbracoIdentityRole(string? roleName)
: base(roleName)
{
}
@@ -26,7 +26,7 @@ public class UmbracoIdentityRole : IdentityRole, IRememberBeingDirty
}
///
- public override string Id
+ public override string? Id
{
get => _id;
set
@@ -40,11 +40,11 @@ public class UmbracoIdentityRole : IdentityRole, IRememberBeingDirty
public override string? Name
{
get => _name;
- set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _name!, nameof(Name));
+ set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _name, nameof(Name));
}
///
- public override string? NormalizedName { get => base.Name ?? string.Empty; set => base.Name = value; }
+ public override string NormalizedName { get => base.Name; set => base.Name = value; }
///
/// Gets or sets a value indicating whether returns an Id has been set on this object this will be false if the object
@@ -58,7 +58,7 @@ public class UmbracoIdentityRole : IdentityRole, IRememberBeingDirty
// model. A good writeup of that is here:
// https://stackoverflow.com/a/37362173
// For our purposes currently we won't worry about this.
- public override string? ConcurrencyStamp { get => base.ConcurrencyStamp; set => base.ConcurrencyStamp = value; }
+ public override string ConcurrencyStamp { get => base.ConcurrencyStamp; set => base.ConcurrencyStamp = value; }
///
/// Gets the for change tracking
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoIdentityUser.cs b/src/Umbraco.Infrastructure/Security/UmbracoIdentityUser.cs
index 7a44933e46..bf79ab602d 100644
--- a/src/Umbraco.Infrastructure/Security/UmbracoIdentityUser.cs
+++ b/src/Umbraco.Infrastructure/Security/UmbracoIdentityUser.cs
@@ -71,7 +71,7 @@ public abstract class UmbracoIdentityUser : IdentityUser, IRememberBeingDirty
// model. A good writeup of that is here:
// https://stackoverflow.com/a/37362173
// For our purposes currently we won't worry about this.
- public override string? ConcurrencyStamp { get => base.ConcurrencyStamp; set => base.ConcurrencyStamp = value; }
+ public override string ConcurrencyStamp { get => base.ConcurrencyStamp; set => base.ConcurrencyStamp = value; }
///
/// Gets or sets last login date
@@ -85,7 +85,7 @@ public abstract class UmbracoIdentityUser : IdentityUser, IRememberBeingDirty
///
/// Gets or sets email
///
- public override string? Email
+ public override string Email
{
get => _email;
set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _email!, nameof(Email));
@@ -247,7 +247,7 @@ public abstract class UmbracoIdentityUser : IdentityUser, IRememberBeingDirty
///
/// Gets or sets user name
///
- public override string? UserName
+ public override string UserName
{
get => _userName;
set => BeingDirty.SetPropertyValueAndDetectChanges(value, ref _userName!, nameof(UserName));
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs b/src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs
index dd3572c928..bc8b8078ca 100644
--- a/src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs
+++ b/src/Umbraco.Infrastructure/Security/UmbracoUserManager.cs
@@ -134,8 +134,8 @@ public abstract class UmbracoUserManager : UserManager
public override async Task CheckPasswordAsync(TUser user, string? password)
{
- // we cannot proceed if the user passed in does not have an identity, or if no password is provided.
- if (user.HasIdentity == false || password is null)
+ // we cannot proceed if the user passed in does not have an identity
+ if (user.HasIdentity == false)
{
return false;
}
@@ -158,10 +158,10 @@ public abstract class UmbracoUserManager : UserManager
- public virtual async Task ChangePasswordWithResetAsync(string userId, string token, string newPassword)
+ public virtual async Task ChangePasswordWithResetAsync(string userId, string token, string? newPassword)
{
- TUser? user = await FindByIdAsync(userId);
- if (user is null)
+ TUser user = await FindByIdAsync(userId);
+ if (user == null)
{
throw new InvalidOperationException("Could not find user");
}
@@ -251,8 +251,8 @@ public abstract class UmbracoUserManager : UserManager ValidateCredentialsAsync(string username, string password)
{
- TUser? user = await FindByNameAsync(username);
- if (user is null)
+ TUser user = await FindByNameAsync(username);
+ if (user == null)
{
return false;
}
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs b/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs
index 35a8f2eea9..7a6c9d793a 100644
--- a/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs
@@ -84,7 +84,7 @@ public abstract class UmbracoUserStore
}
///
- public override Task FindByIdAsync(string userId, CancellationToken cancellationToken = default) =>
+ public override Task FindByIdAsync(string userId, CancellationToken cancellationToken = default) =>
FindUserAsync(userId, cancellationToken);
///
@@ -96,11 +96,11 @@ public abstract class UmbracoUserStore
throw new NotImplementedException();
///
- public override Task GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken)
+ public override Task GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken)
=> GetEmailAsync(user, cancellationToken);
///
- public override Task GetNormalizedUserNameAsync(TUser user, CancellationToken cancellationToken = default)
+ public override Task GetNormalizedUserNameAsync(TUser user, CancellationToken cancellationToken = default)
=> GetUserNameAsync(user, cancellationToken);
///
@@ -221,15 +221,15 @@ public abstract class UmbracoUserStore
public override Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default) => throw new NotImplementedException();
///
- public override Task SetNormalizedEmailAsync(TUser user, string? normalizedEmail, CancellationToken cancellationToken)
+ public override Task SetNormalizedEmailAsync(TUser user, string normalizedEmail, CancellationToken cancellationToken)
=> SetEmailAsync(user, normalizedEmail, cancellationToken);
///
- public override Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken = default)
+ public override Task SetNormalizedUserNameAsync(TUser user, string normalizedName, CancellationToken cancellationToken = default)
=> SetUserNameAsync(user, normalizedName, cancellationToken);
///
- public override async Task SetPasswordHashAsync(TUser user, string? passwordHash, CancellationToken cancellationToken = default)
+ public override async Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken = default)
{
await base.SetPasswordHashAsync(user, passwordHash, cancellationToken);
user.LastPasswordChangeDateUtc = DateTime.UtcNow;
@@ -247,7 +247,7 @@ public abstract class UmbracoUserStore
///
///
[EditorBrowsable(EditorBrowsableState.Never)]
- protected override Task?> FindTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken) => throw new NotImplementedException();
+ protected override Task> FindTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken) => throw new NotImplementedException();
///
/// Not supported in Umbraco, see comments above on GetTokenAsync, RemoveTokenAsync, SetTokenAsync
diff --git a/src/Umbraco.Infrastructure/Templates/HtmlMacroParameterParser.cs b/src/Umbraco.Infrastructure/Templates/HtmlMacroParameterParser.cs
index 5257b2f141..721e99bbd7 100644
--- a/src/Umbraco.Infrastructure/Templates/HtmlMacroParameterParser.cs
+++ b/src/Umbraco.Infrastructure/Templates/HtmlMacroParameterParser.cs
@@ -79,7 +79,7 @@ public sealed class HtmlMacroParameterParser : IHtmlMacroParameterParser
private IEnumerable GetUmbracoEntityReferencesFromMacros(
List>> macros)
{
- if (_macroService is not IMacroService macroWithAliasService)
+ if (_macroService is not IMacroWithAliasService macroWithAliasService)
{
yield break;
}
diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
index d8cd543dca..9676417cac 100644
--- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
+++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Umbraco.Cms.Infrastructure
Umbraco.Cms.Infrastructure
Umbraco CMS Infrastructure
@@ -23,11 +23,6 @@
-
-
-
-
-
diff --git a/src/Umbraco.New.Cms.Core/Umbraco.New.Cms.Core.csproj b/src/Umbraco.New.Cms.Core/Umbraco.New.Cms.Core.csproj
index 0e0cb355cb..e7c38a23af 100644
--- a/src/Umbraco.New.Cms.Core/Umbraco.New.Cms.Core.csproj
+++ b/src/Umbraco.New.Cms.Core/Umbraco.New.Cms.Core.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
enable
enable
Umbraco.New.Cms.Core
diff --git a/src/Umbraco.New.Cms.Infrastructure/Umbraco.New.Cms.Infrastructure.csproj b/src/Umbraco.New.Cms.Infrastructure/Umbraco.New.Cms.Infrastructure.csproj
index 37a91d4599..27e27cc981 100644
--- a/src/Umbraco.New.Cms.Infrastructure/Umbraco.New.Cms.Infrastructure.csproj
+++ b/src/Umbraco.New.Cms.Infrastructure/Umbraco.New.Cms.Infrastructure.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
enable
enable
Umbraco.New.Cms.Infrastructure
diff --git a/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs b/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs
index accb5fd82b..0a923da01d 100644
--- a/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs
+++ b/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs
@@ -22,12 +22,8 @@ public class SignInUserStep : IInstallStep
public async Task ExecuteAsync(InstallData model)
{
- BackOfficeIdentityUser? identityUser = await _backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
-
- if (identityUser is not null)
- {
- await _backOfficeSignInManager.SignInAsync(identityUser, false);
- }
+ BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
+ await _backOfficeSignInManager.SignInAsync(identityUser, false);
}
public Task RequiresExecutionAsync(InstallData model) => Task.FromResult(true);
diff --git a/src/Umbraco.New.Cms.Web.Common/Umbraco.New.Cms.Web.Common.csproj b/src/Umbraco.New.Cms.Web.Common/Umbraco.New.Cms.Web.Common.csproj
index d9826126de..159537c9d8 100644
--- a/src/Umbraco.New.Cms.Web.Common/Umbraco.New.Cms.Web.Common.csproj
+++ b/src/Umbraco.New.Cms.Web.Common/Umbraco.New.Cms.Web.Common.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
enable
enable
false
diff --git a/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs b/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
index c47c04b548..6f0360bba8 100644
--- a/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
+++ b/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
@@ -1,18 +1,22 @@
-using Umbraco.Cms.Core.Models.PublishedContent;
+using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
namespace Umbraco.Cms.Infrastructure.PublishedCache;
- public struct ContentNodeKit
- {
- public ContentNode Node { get; } = null!;
+public struct ContentNodeKit
+{
+ [Obsolete("This will be changed to a property in future versions")]
+ public ContentNode Node = null!;
- public int ContentTypeId { get; }
+ [Obsolete("This will be changed to a property in future versions")]
+ public int ContentTypeId;
- public ContentData? DraftData { get; }
+ [Obsolete("This will be changed to a property in future versions")]
+ public ContentData? DraftData;
- public ContentData? PublishedData { get; }
+ [Obsolete("This will be changed to a property in future versions")]
+ public ContentData? PublishedData;
public ContentNodeKit(ContentNode node, int contentTypeId, ContentData? draftData, ContentData? publishedData)
{
diff --git a/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs b/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs
index a7e0b60373..7e209cb97d 100644
--- a/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs
+++ b/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs
@@ -1,11 +1,30 @@
-namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
+namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
///
-/// Represents everything that is specific to an edited or published content version
+/// Represents everything that is specific to an edited or published content version
///
public class ContentData
{
- public ContentData(string? name, string? urlSegment, int versionId, DateTime versionDate, int writerId, int? templateId, bool published, IDictionary? properties, IReadOnlyDictionary? cultureInfos)
+ // Scheduled for removal in V11
+ [Obsolete("Use ctor with all params, as the pros should be immutable")]
+ public ContentData()
+ {
+ Name = string.Empty;
+ UrlSegment = string.Empty;
+ Properties = null!;
+ CultureInfos = null!;
+ }
+
+ public ContentData(
+ string? name,
+ string? urlSegment,
+ int versionId,
+ DateTime versionDate,
+ int writerId,
+ int? templateId,
+ bool published,
+ IDictionary? properties,
+ IReadOnlyDictionary? cultureInfos)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
UrlSegment = urlSegment;
@@ -18,19 +37,69 @@ public class ContentData
CultureInfos = cultureInfos;
}
- public string Name { get; }
- public string? UrlSegment { get; }
- public int VersionId { get; }
- public DateTime VersionDate { get; }
- public int WriterId { get; }
- public int? TemplateId { get; }
- public bool Published { get; }
+ public string Name
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
- public IDictionary Properties { get; }
+ public string? UrlSegment
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public int VersionId
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public DateTime VersionDate
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public int WriterId
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public int? TemplateId
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public bool Published
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
+
+ public IDictionary Properties
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
///
- /// The collection of language Id to name for the content item
+ /// The collection of language Id to name for the content item
///
- public IReadOnlyDictionary? CultureInfos { get; }
+ public IReadOnlyDictionary? CultureInfos
+ {
+ get;
+ [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
+ set;
+ }
}
-
diff --git a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
index 4a2f763d36..7b729d5097 100644
--- a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
+++ b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Umbraco.Cms.Infrastructure.PublishedCache
Umbraco.Cms.PublishedCache.NuCache
Umbraco CMS Published Cache
diff --git a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
index 7704344d4e..390482276e 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
@@ -186,13 +186,11 @@ public class AuthenticationController : UmbracoApiControllerBase
[ValidateAngularAntiForgeryToken]
public async Task PostUnLinkLogin(UnLinkLoginModel unlinkLoginModel)
{
- var userId = User.Identity?.GetUserId();
- if (userId is null)
+ BackOfficeIdentityUser? user = await _userManager.FindByIdAsync(User.Identity?.GetUserId());
+ if (user == null)
{
- throw new InvalidOperationException("Could not find userId");
+ throw new InvalidOperationException("Could not find user");
}
- var user = await _userManager.FindByIdAsync(userId);
- if (user == null) throw new InvalidOperationException("Could not find user");
AuthenticationScheme? authType = (await _signInManager.GetExternalAuthenticationSchemesAsync())
.FirstOrDefault(x => x.Name == unlinkLoginModel.LoginProvider);
@@ -486,19 +484,16 @@ public class AuthenticationController : UmbracoApiControllerBase
UmbracoUserExtensions.GetUserCulture(user.Culture, _textService, _globalSettings),
new[] { code });
- if (provider == "Email")
- {
- var mailMessage = new EmailMessage(from, user.Email, subject, message, true);
- await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.TwoFactorAuth);
- }
- else if (provider == "Phone")
- {
- var phoneNumber = await _userManager.GetPhoneNumberAsync(user);
- if (phoneNumber is not null)
- {
- await _smsSender.SendSmsAsync(phoneNumber, message);
- }
- }
+ if (provider == "Email")
+ {
+ var mailMessage = new EmailMessage(from, user.Email, subject, message, true);
+
+ await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.TwoFactorAuth);
+ }
+ else if (provider == "Phone")
+ {
+ await _smsSender.SendSmsAsync(await _userManager.GetPhoneNumberAsync(user), message);
+ }
return Ok();
}
@@ -549,10 +544,6 @@ public class AuthenticationController : UmbracoApiControllerBase
{
BackOfficeIdentityUser? identityUser =
await _userManager.FindByIdAsync(model.UserId.ToString(CultureInfo.InvariantCulture));
- if (identityUser is null)
- {
- return new ValidationErrorResult("Could not find user");
- }
IdentityResult result = await _userManager.ResetPasswordAsync(identityUser, model.ResetCode, model.Password);
if (result.Succeeded)
diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
index ae0b9c961f..c5567d1796 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
@@ -386,7 +386,7 @@ public class BackOfficeController : UmbracoController
[HttpGet]
public async Task ExternalLinkLoginCallback()
{
- BackOfficeIdentityUser? user = await _userManager.GetUserAsync(User);
+ BackOfficeIdentityUser user = await _userManager.GetUserAsync(User);
if (user == null)
{
// ... this should really not happen
@@ -504,8 +504,9 @@ public class BackOfficeController : UmbracoController
}
else if (result == SignInResult.TwoFactorRequired)
{
- BackOfficeIdentityUser? attemptedUser = await _userManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey);
- if (attemptedUser?.UserName is null)
+ BackOfficeIdentityUser? attemptedUser =
+ await _userManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey);
+ if (attemptedUser == null)
{
return new ValidationErrorResult(
$"No local user found for the login provider {loginInfo.LoginProvider} - {loginInfo.ProviderKey}");
diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
index c8a3c710ec..6471b5b2ae 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
@@ -376,7 +376,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"currentUserApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
- controller => controller.PostSetAvatar(new List()))
+ controller => controller.PostChangePassword(new ChangingPasswordModel()))
},
{
"entityApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
@@ -416,7 +416,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"memberTypeApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
- controller => controller.GetById(0))
+ controller => controller.GetAllTypes())
},
{
"memberTypeQueryApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
diff --git a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
index 87f881ff69..f867ccc5a1 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
@@ -81,15 +81,47 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
_userDataService = userDataService;
}
- ///
- /// Returns permissions for all nodes passed in for the current user
- ///
- ///
- ///
- [HttpPost]
- public Dictionary GetPermissions(int[] nodeIds)
- {
- EntityPermissionCollection permissions = _userService
+ [Obsolete("This constructor is obsolete and will be removed in v11, use constructor with all values")]
+ public CurrentUserController(
+ MediaFileManager mediaFileManager,
+ IOptions contentSettings,
+ IHostingEnvironment hostingEnvironment,
+ IImageUrlGenerator imageUrlGenerator,
+ IBackOfficeSecurityAccessor backofficeSecurityAccessor,
+ IUserService userService,
+ IUmbracoMapper umbracoMapper,
+ IBackOfficeUserManager backOfficeUserManager,
+ ILoggerFactory loggerFactory,
+ ILocalizedTextService localizedTextService,
+ AppCaches appCaches,
+ IShortStringHelper shortStringHelper,
+ IPasswordChanger passwordChanger) : this(
+ mediaFileManager,
+ StaticServiceProvider.Instance.GetRequiredService>(),
+ hostingEnvironment,
+ imageUrlGenerator,
+ backofficeSecurityAccessor,
+ userService,
+ umbracoMapper,
+ backOfficeUserManager,
+ localizedTextService,
+ appCaches,
+ shortStringHelper,
+ passwordChanger,
+ StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
+
+ ///
+ /// Returns permissions for all nodes passed in for the current user
+ ///
+ ///
+ ///
+ [HttpPost]
+ public Dictionary GetPermissions(int[] nodeIds)
+ {
+ EntityPermissionCollection permissions = _userService
.GetPermissions(_backofficeSecurityAccessor.BackOfficeSecurity?.CurrentUser, nodeIds);
var permissionsDictionary = new Dictionary();
@@ -198,13 +230,12 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[AllowAnonymous]
public async Task> PostSetInvitedUserPassword([FromBody] string newPassword)
{
- var userId = _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString();
- if (userId is null)
+ BackOfficeIdentityUser? user = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
+ .BackOfficeSecurity?.GetUserId().ResultOr(0).ToString());
+ if (user == null)
{
- throw new InvalidOperationException("Could not find user Id");
+ throw new InvalidOperationException("Could not find user");
}
- var user = await _backOfficeUserManager.FindByIdAsync(userId);
- if (user == null) throw new InvalidOperationException("Could not find user");
IdentityResult result = await _backOfficeUserManager.AddPasswordAsync(user, newPassword);
@@ -304,18 +335,8 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[ValidateAngularAntiForgeryToken]
public async Task> GetCurrentUserLinkedLogins()
{
- var userId = _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString(CultureInfo.InvariantCulture);
- if (userId is null)
- {
- throw new InvalidOperationException("Could not find user Id");
- }
-
- BackOfficeIdentityUser? identityUser = await _backOfficeUserManager.FindByIdAsync(userId);
-
- if (identityUser is null)
- {
- throw new InvalidOperationException("Could not find user");
- }
+ BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
+ .BackOfficeSecurity?.GetUserId().ResultOr(0).ToString(CultureInfo.InvariantCulture));
// deduplicate in case there are duplicates (there shouldn't be now since we have a unique constraint on the external logins
// but there didn't used to be)
diff --git a/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs b/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
index ba9809f657..92779c18fa 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
@@ -471,6 +471,46 @@ public class EntityController : UmbracoAuthorizedJsonController
.Select(id => new { Id = id, Url = MediaOrDocumentUrl(id) }).ToDictionary(x => x.Id, x => x.Url);
}
+ ///
+ /// Get entity URLs by UDIs
+ ///
+ ///
+ /// A list of UDIs to lookup items by
+ ///
+ /// The culture to fetch the URL for
+ /// Dictionary mapping Udi -> Url
+ ///
+ /// We allow for POST because there could be quite a lot of Ids.
+ ///
+ [HttpGet]
+ [HttpPost]
+ [Obsolete("Use GetUrlsByIds instead.")]
+ public IDictionary GetUrlsByUdis([FromJsonPath] Udi[] udis, string? culture = null)
+ {
+ if (udis == null || !udis.Any())
+ {
+ return new Dictionary();
+ }
+
+ var udiEntityType = udis.First().EntityType;
+ UmbracoEntityTypes entityType;
+
+ switch (udiEntityType)
+ {
+ case Constants.UdiEntityType.Document:
+ entityType = UmbracoEntityTypes.Document;
+ break;
+ case Constants.UdiEntityType.Media:
+ entityType = UmbracoEntityTypes.Media;
+ break;
+ default:
+ entityType = (UmbracoEntityTypes)(-1);
+ break;
+ }
+
+ return GetUrlsByIds(udis, entityType, culture);
+ }
+
///
/// Gets the URL of an entity
///
diff --git a/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs b/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs
index 8dd599be46..6cb7f1f4bc 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs
@@ -18,6 +18,12 @@ public class HelpController : UmbracoAuthorizedJsonController
private readonly ILogger _logger;
private HelpPageSettings? _helpPageSettings;
+ [Obsolete("Use constructor that takes IOptions")]
+ public HelpController(ILogger logger)
+ : this(logger, StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
[ActivatorUtilitiesConstructor]
public HelpController(
ILogger logger,
diff --git a/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs b/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
index 4cb7dc52fc..bb515b61fc 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
@@ -30,13 +30,21 @@ public class LanguageController : UmbracoAuthorizedJsonController
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
}
- ///
- /// Returns all cultures available for creating languages.
- ///
- ///
- [HttpGet]
- public IDictionary GetAllCultures()
- => CultureInfo.GetCultures(CultureTypes.AllCultures).DistinctBy(x => x.Name).OrderBy(x => x.EnglishName).ToDictionary(x => x.Name, x => x.EnglishName);
+ [Obsolete("Use the constructor without global settings instead, scheduled for removal in V11.")]
+ public LanguageController(ILocalizationService localizationService, IUmbracoMapper umbracoMapper,
+ IOptionsSnapshot globalSettings)
+ : this(localizationService, umbracoMapper)
+ {
+ }
+
+ ///
+ /// Returns all cultures available for creating languages.
+ ///
+ ///
+ [HttpGet]
+ public IDictionary GetAllCultures()
+ => CultureInfo.GetCultures(CultureTypes.AllCultures).DistinctBy(x => x.Name).OrderBy(x => x.EnglishName)
+ .ToDictionary(x => x.Name, x => x.EnglishName);
///
/// Returns all currently configured languages.
diff --git a/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs b/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs
index 7389af5112..4c3cce59a5 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs
@@ -22,6 +22,12 @@ public class LogViewerController : BackOfficeNotificationsController
private readonly ILogLevelLoader _logLevelLoader;
private readonly ILogViewer _logViewer;
+ [Obsolete]
+ public LogViewerController(ILogViewer logViewer)
+ : this(logViewer, StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
[ActivatorUtilitiesConstructor]
public LogViewerController(ILogViewer logViewer, ILogLevelLoader logLevelLoader)
{
@@ -141,4 +147,8 @@ public class LogViewerController : BackOfficeNotificationsController
[HttpGet]
public ReadOnlyDictionary GetLogLevels() => _logLevelLoader.GetLogLevelsFromSinks();
+
+ [Obsolete("Please use GetLogLevels() instead. Scheduled for removal in V11.")]
+ [HttpGet]
+ public string GetLogLevel() => _logViewer.GetLogLevel();
}
diff --git a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
index b81d120295..50c54f420f 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
@@ -986,6 +986,37 @@ public class MediaController : ContentControllerBase
return new ActionResult(toMove);
}
+ [Obsolete(
+ "Please use TrackedReferencesController.GetPagedRelationsForItem() instead. Scheduled for removal in V11.")]
+ public PagedResult GetPagedReferences(int id, string entityType, int pageNumber = 1,
+ int pageSize = 100)
+ {
+ if (pageNumber <= 0 || pageSize <= 0)
+ {
+ throw new NotSupportedException("Both pageNumber and pageSize must be greater than zero");
+ }
+
+ UmbracoObjectTypes objectType = ObjectTypes.GetUmbracoObjectType(entityType);
+ var udiType = objectType.GetUdiType();
+
+ IEnumerable relations =
+ _relationService.GetPagedParentEntitiesByChildId(id, pageNumber - 1, pageSize, out var totalRecords,
+ objectType);
+
+ return new PagedResult(totalRecords, pageNumber, pageSize)
+ {
+ Items = relations.Cast().Select(rel => new EntityBasic
+ {
+ Id = rel.Id,
+ Key = rel.Key,
+ Udi = Udi.Create(udiType, rel.Key),
+ Icon = rel.ContentTypeIcon,
+ Name = rel.Name,
+ Alias = rel.ContentTypeAlias
+ })
+ };
+ }
+
#region GetChildren
private int[]? _userStartNodes;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs b/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
index b7220a3941..70f337f44f 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MemberController.cs
@@ -367,7 +367,7 @@ public class MemberController : ContentControllerBase
contentItem.IsApproved,
contentItem.Name);
- IdentityResult created = await _memberManager.CreateAsync(identityMember, contentItem.Password?.NewPassword!);
+ IdentityResult created = await _memberManager.CreateAsync(identityMember, contentItem.Password?.NewPassword);
if (created.Succeeded == false)
{
@@ -513,12 +513,8 @@ public class MemberController : ContentControllerBase
}
var needsResync = false;
- var memberId = contentItem.Id?.ToString();
- if (memberId is null)
- {
- return ValidationProblem("Member was not found");
- }
- MemberIdentityUser? identityMember = await _memberManager.FindByIdAsync(memberId);
+
+ MemberIdentityUser identityMember = await _memberManager.FindByIdAsync(contentItem.Id?.ToString());
if (identityMember == null)
{
return ValidationProblem("Member was not found");
diff --git a/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs
index 4184cc5798..984cff0582 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs
@@ -183,6 +183,17 @@ public class MemberTypeController : ContentTypeControllerBase
return dto;
}
+
+ ///
+ /// Returns all member types
+ ///
+ [Obsolete(
+ "Use MemberTypeQueryController.GetAllTypes instead as it only requires AuthorizationPolicies.TreeAccessMembersOrMemberTypes and not both this and AuthorizationPolicies.TreeAccessMemberTypes")]
+ [Authorize(Policy = AuthorizationPolicies.TreeAccessMembersOrMemberTypes)]
+ public IEnumerable GetAllTypes() =>
+ _memberTypeService.GetAll()
+ .Select(_umbracoMapper.Map).WhereNotNull();
+
public ActionResult PostSave(MemberTypeSave contentTypeSave)
{
//get the persisted member type
diff --git a/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs b/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs
index 6a4e7ca236..be57a93328 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs
@@ -39,14 +39,23 @@ public class TemplateController : BackOfficeNotificationsController
throw new ArgumentNullException(nameof(defaultViewContentProvider));
}
- ///
- /// Gets data type by alias
- ///
- ///
- ///
- public TemplateDisplay? GetByAlias(string alias)
- {
- ITemplate? template = _fileService.GetTemplate(alias);
+ [Obsolete("Use ctor will all params")]
+ public TemplateController(
+ IFileService fileService,
+ IUmbracoMapper umbracoMapper,
+ IShortStringHelper shortStringHelper)
+ : this(fileService, umbracoMapper, shortStringHelper, StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
+ ///
+ /// Gets data type by alias
+ ///
+ ///
+ ///
+ public TemplateDisplay? GetByAlias(string alias)
+ {
+ ITemplate? template = _fileService.GetTemplate(alias);
return template == null ? null : _umbracoMapper.Map(template);
}
diff --git a/src/Umbraco.Web.BackOffice/Controllers/TwoFactorLoginController.cs b/src/Umbraco.Web.BackOffice/Controllers/TwoFactorLoginController.cs
index 68a8773362..b0e081e9de 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/TwoFactorLoginController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/TwoFactorLoginController.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -23,7 +23,7 @@ public class TwoFactorLoginController : UmbracoAuthorizedJsonController
private readonly IBackOfficeSignInManager _backOfficeSignInManager;
private readonly IBackOfficeUserManager _backOfficeUserManager;
private readonly ILogger _logger;
- private readonly ITwoFactorLoginService _twoFactorLoginService;
+ private readonly ITwoFactorLoginService2 _twoFactorLoginService;
private readonly IOptionsSnapshot _twoFactorLoginViewOptions;
public TwoFactorLoginController(
@@ -36,7 +36,15 @@ public class TwoFactorLoginController : UmbracoAuthorizedJsonController
{
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
_logger = logger;
- _twoFactorLoginService = twoFactorLoginService;
+
+ if (twoFactorLoginService is not ITwoFactorLoginService2 twoFactorLoginService2)
+ {
+ throw new ArgumentException(
+ "twoFactorLoginService needs to implement ITwoFactorLoginService2 until the interfaces are merged",
+ nameof(twoFactorLoginService));
+ }
+
+ _twoFactorLoginService = twoFactorLoginService2;
_backOfficeSignInManager = backOfficeSignInManager;
_backOfficeUserManager = backOfficeUserManager;
_twoFactorLoginViewOptions = twoFactorLoginViewOptions;
@@ -65,11 +73,7 @@ public class TwoFactorLoginController : UmbracoAuthorizedJsonController
[HttpGet]
public async Task>> Get2FAProvidersForUser(int userId)
{
- BackOfficeIdentityUser? user = await _backOfficeUserManager.FindByIdAsync(userId.ToString(CultureInfo.InvariantCulture));
- if (user is null)
- {
- throw new InvalidOperationException("Could not find user");
- }
+ BackOfficeIdentityUser user = await _backOfficeUserManager.FindByIdAsync(userId.ToString(CultureInfo.InvariantCulture));
var enabledProviderNameHashSet =
new HashSet(await _twoFactorLoginService.GetEnabledTwoFactorProviderNamesAsync(user.Key));
diff --git a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
index 916ff3d495..f734d8626b 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
@@ -565,20 +565,10 @@ public class UsersController : BackOfficeNotificationsController
return new ActionResult(user);
}
- private async Task SendUserInviteEmailAsync(UserBasic? userDisplay, string? from, string? fromEmail, IUser? to, string? message)
+ private async Task SendUserInviteEmailAsync(UserBasic? userDisplay, string? from, string? fromEmail, IUser? to,
+ string? message)
{
- var userId = userDisplay?.Id?.ToString();
- if (userId is null)
- {
- throw new InvalidOperationException("Could not find user Id");
- }
- var user = await _userManager.FindByIdAsync(userId);
-
- if (user is null)
- {
- throw new InvalidOperationException("Could not find user");
- }
-
+ BackOfficeIdentityUser user = await _userManager.FindByIdAsync(((int?)userDisplay?.Id).ToString());
var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
// Use info from SMTP Settings if configured, otherwise set fromEmail as fallback
diff --git a/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.LocalizedText.cs b/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.LocalizedText.cs
index 9d677bce66..54e25240e0 100644
--- a/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.LocalizedText.cs
+++ b/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.LocalizedText.cs
@@ -48,7 +48,7 @@ namespace Umbraco.Extensions
IEnumerable userLangFileSources = contentFileProvider.GetDirectoryContents(userConfigLangFolder)
.Where(x => x.IsDirectory && x.Name.InvariantEquals("lang"))
- .Select(x => new DirectoryInfo(x.PhysicalPath!))
+ .Select(x => new DirectoryInfo(x.PhysicalPath))
.SelectMany(x => x.GetFiles("*.user.xml", SearchOption.TopDirectoryOnly))
.Select(x => new LocalizedTextServiceSupplementaryFileSource(x, true));
@@ -87,7 +87,7 @@ namespace Umbraco.Extensions
.GetDirectoryContents(langFolder)
.Where(x => !string.IsNullOrEmpty(x.PhysicalPath))
.Where(x => x.Name.InvariantEndsWith(".xml"))
- .Select(x => new FileInfo(x.PhysicalPath!));
+ .Select(x => new FileInfo(x.PhysicalPath));
foreach (FileInfo file in localizationFiles)
{
diff --git a/src/Umbraco.Web.BackOffice/Install/CreateUnattendedUserNotificationHandler.cs b/src/Umbraco.Web.BackOffice/Install/CreateUnattendedUserNotificationHandler.cs
index 1ac7f20819..13896c8912 100644
--- a/src/Umbraco.Web.BackOffice/Install/CreateUnattendedUserNotificationHandler.cs
+++ b/src/Umbraco.Web.BackOffice/Install/CreateUnattendedUserNotificationHandler.cs
@@ -75,7 +75,7 @@ public class CreateUnattendedUserNotificationHandler : INotificationAsyncHandler
using IServiceScope scope = _serviceScopeFactory.CreateScope();
IBackOfficeUserManager backOfficeUserManager =
scope.ServiceProvider.GetRequiredService();
- BackOfficeIdentityUser? membershipUser =
+ BackOfficeIdentityUser membershipUser =
await backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
if (membershipUser == null)
{
diff --git a/src/Umbraco.Web.BackOffice/Install/InstallApiController.cs b/src/Umbraco.Web.BackOffice/Install/InstallApiController.cs
index 52068c6f8d..555c14ff96 100644
--- a/src/Umbraco.Web.BackOffice/Install/InstallApiController.cs
+++ b/src/Umbraco.Web.BackOffice/Install/InstallApiController.cs
@@ -94,12 +94,8 @@ public class InstallApiController : ControllerBase
if (levelBeforeRestart == RuntimeLevel.Install)
{
- BackOfficeIdentityUser? identityUser =
- await _backOfficeUserManager.FindByIdAsync(Core.Constants.Security.SuperUserIdAsString);
- if (identityUser is not null)
- {
- _backOfficeSignInManager.SignInAsync(identityUser, false);
- }
+ BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(Core.Constants.Security.SuperUserIdAsString);
+ _backOfficeSignInManager.SignInAsync(identityUser, false);
}
return NoContent();
diff --git a/src/Umbraco.Web.BackOffice/Middleware/ConfigureGlobalOptionsForKeepAliveMiddlware.cs b/src/Umbraco.Web.BackOffice/Middleware/ConfigureGlobalOptionsForKeepAliveMiddlware.cs
index 5156ad3af5..15366ec113 100644
--- a/src/Umbraco.Web.BackOffice/Middleware/ConfigureGlobalOptionsForKeepAliveMiddlware.cs
+++ b/src/Umbraco.Web.BackOffice/Middleware/ConfigureGlobalOptionsForKeepAliveMiddlware.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Options;
+using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
namespace Umbraco.Cms.Web.BackOffice.Middleware;
@@ -18,6 +18,6 @@ public sealed class ConfigureGlobalOptionsForKeepAliveMiddlware : IPostConfigure
///
///
///
- public void PostConfigure(string? name, GlobalSettings options) =>
+ public void PostConfigure(string name, GlobalSettings options) =>
options.ReservedUrls += _keepAliveSettings.Value.KeepAlivePingUrl;
}
diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs
index f4aed22fbe..24217d331b 100644
--- a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs
+++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs
@@ -62,10 +62,10 @@ public class BackOfficeAuthenticationBuilder : AuthenticationBuilder
internal class EnsureBackOfficeScheme : IPostConfigureOptions
where TOptions : RemoteAuthenticationOptions
{
- public void PostConfigure(string? name, TOptions options)
+ public void PostConfigure(string name, TOptions options)
{
// ensure logic only applies to backoffice authentication schemes
- if (name is not null && name.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix))
+ if (name.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix))
{
options.SignInScheme = Constants.Security.BackOfficeExternalAuthenticationType;
}
diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
index f0cb1beee5..15413db2a7 100644
--- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
+++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
@@ -126,12 +126,7 @@ public class BackOfficeSessionIdValidator
}
var userId = currentIdentity.GetUserId();
- if (userId is null)
- {
- return false;
- }
-
- var user = await _userManager.FindByIdAsync(userId);
+ BackOfficeIdentityUser? user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
return false;
diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
index 19a231cf52..74f5fb5eb8 100644
--- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
+++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
@@ -117,7 +117,7 @@ public class BackOfficeSignInManager : UmbracoSignInManagerThe external login URL users should be redirected to during the login flow.
/// The current user's identifier, which will be used to provide CSRF protection.
/// A configured .
- public override AuthenticationProperties ConfigureExternalAuthenticationProperties(string? provider, string? redirectUrl, string? userId = null)
+ public override AuthenticationProperties ConfigureExternalAuthenticationProperties(string provider, string? redirectUrl, string? userId = null)
{
// borrowed from https://github.com/dotnet/aspnetcore/blob/master/src/Identity/Core/src/SignInManager.cs
// to be able to use our own XsrfKey/LoginProviderKey because the default is private :/
@@ -197,7 +197,7 @@ public class BackOfficeSignInManager : UmbracoSignInManager
- public void Configure(string? name, CookieAuthenticationOptions options)
+ public void Configure(string name, CookieAuthenticationOptions options)
{
if (name != Constants.Security.BackOfficeAuthenticationType)
{
diff --git a/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs b/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
index 25f0548386..59ea9a7b81 100644
--- a/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
+++ b/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
@@ -52,7 +52,7 @@ internal class PasswordChanger : IPasswordChanger where TUser : Um
}
var userId = changingPasswordModel.Id.ToString();
- TUser? identityUser = await userMgr.FindByIdAsync(userId);
+ TUser identityUser = await userMgr.FindByIdAsync(userId);
if (identityUser == null)
{
// this really shouldn't ever happen... but just in case
@@ -96,7 +96,7 @@ internal class PasswordChanger : IPasswordChanger where TUser : Um
}
// can we change to the new password?
- IdentityResult changeResult = await userMgr.ChangePasswordAsync(identityUser, changingPasswordModel.OldPassword!, changingPasswordModel.NewPassword);
+ IdentityResult changeResult = await userMgr.ChangePasswordAsync(identityUser, changingPasswordModel.OldPassword, changingPasswordModel.NewPassword);
if (changeResult.Succeeded == false)
{
// no, fail with error messages for "password"
diff --git a/src/Umbraco.Web.BackOffice/Services/IconService.cs b/src/Umbraco.Web.BackOffice/Services/IconService.cs
index fa6bf3eb4c..7f060dc756 100644
--- a/src/Umbraco.Web.BackOffice/Services/IconService.cs
+++ b/src/Umbraco.Web.BackOffice/Services/IconService.cs
@@ -141,7 +141,7 @@ public class IconService : IIconService
IEnumerable coreIcons = iconFolder
.Where(x => !x.IsDirectory && x.Name.EndsWith(".svg"))
- .Select(x => new FileInfo(x.PhysicalPath!));
+ .Select(x => new FileInfo(x.PhysicalPath));
icons.UnionWith(coreIcons);
diff --git a/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs
index 8b8a885fd5..f9efabd83f 100644
--- a/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs
+++ b/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs
@@ -33,6 +33,21 @@ public abstract class MemberTypeAndGroupTreeControllerBase : TreeController
_memberTypeService = memberTypeService;
}
+ [Obsolete("Use ctor injecting IMemberTypeService")]
+ protected MemberTypeAndGroupTreeControllerBase(
+ ILocalizedTextService localizedTextService,
+ UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection,
+ IMenuItemCollectionFactory menuItemCollectionFactory,
+ IEventAggregator eventAggregator)
+ : this(
+ localizedTextService,
+ umbracoApiControllerTypeCollection,
+ menuItemCollectionFactory,
+ eventAggregator,
+ StaticServiceProvider.Instance.GetRequiredService())
+ {
+ }
+
public IMenuItemCollectionFactory MenuItemCollectionFactory { get; }
protected override ActionResult GetTreeNodes(string id, FormCollection queryStrings)
diff --git a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
index 7e4a3eb700..21066d19bb 100644
--- a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
+++ b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net6.0
Library
Umbraco.Cms.Web.BackOffice
Umbraco.Cms.Web.BackOffice
diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
index af8fec7f69..57f1e288b7 100644
--- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
@@ -82,7 +82,7 @@ public class AspNetCoreHostingEnvironment : IHostingEnvironment
public Uri ApplicationMainUrl { get; private set; } = null!;
///
- public string? SiteName { get; private set; }
+ public string SiteName { get; private set; } = null!;
///
public string ApplicationId
diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs
index abb2b71a4e..38d67ff2f0 100644
--- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs
@@ -44,10 +44,10 @@ public class AspNetCoreRequestAccessor : IRequestAccessor, INotificationHandler<
});
///
- public string? GetRequestValue(string name) => GetFormValue(name) ?? GetQueryStringValue(name);
+ public string GetRequestValue(string name) => GetFormValue(name) ?? GetQueryStringValue(name);
///
- public string? GetQueryStringValue(string name) => _httpContextAccessor.GetRequiredHttpContext().Request.Query[name];
+ public string GetQueryStringValue(string name) => _httpContextAccessor.GetRequiredHttpContext().Request.Query[name];
///
public Uri? GetRequestUrl() => _httpContextAccessor.HttpContext != null
diff --git a/src/Umbraco.Web.Common/AspNetCore/OptionsMonitorAdapter.cs b/src/Umbraco.Web.Common/AspNetCore/OptionsMonitorAdapter.cs
index fd3d3516af..112841a722 100644
--- a/src/Umbraco.Web.Common/AspNetCore/OptionsMonitorAdapter.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/OptionsMonitorAdapter.cs
@@ -15,7 +15,7 @@ internal class OptionsMonitorAdapter : IOptionsMonitor
public T CurrentValue { get; }
- public T Get(string? name) => CurrentValue;
+ public T Get(string name) => CurrentValue;
public IDisposable OnChange(Action listener) => throw new NotImplementedException();
}
diff --git a/src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs
index e8961dba0a..c91d0fb6c2 100644
--- a/src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs
@@ -49,7 +49,7 @@ public static class FormCollectionExtensions
///
///
///
- public static string? GetRequiredString(this FormCollection items, string key)
+ public static string GetRequiredString(this FormCollection items, string key)
{
if (items.HasKey(key) == false)
{
diff --git a/src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs b/src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs
index e4481f7f28..bdacae95ef 100644
--- a/src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs
@@ -347,4 +347,12 @@ public static class FriendlyImageCropperTemplateExtensions
useCropDimensions,
cacheBusterValue,
furtherOptions);
+
+ [Obsolete(
+ "Use GetCropUrl to merge local and media crops, get automatic cache buster value and have more parameters.")]
+ public static string GetLocalCropUrl(
+ this MediaWithCrops mediaWithCrops,
+ string alias,
+ string? cacheBusterValue = null) => mediaWithCrops.LocalCrops.Src +
+ mediaWithCrops.LocalCrops.GetCropUrl(alias, ImageUrlGenerator, cacheBusterValue: cacheBusterValue);
}
diff --git a/src/Umbraco.Web.Common/Extensions/HttpContextExtensions.cs b/src/Umbraco.Web.Common/Extensions/HttpContextExtensions.cs
index 0f2da0ac4e..226755039e 100644
--- a/src/Umbraco.Web.Common/Extensions/HttpContextExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/HttpContextExtensions.cs
@@ -65,7 +65,7 @@ public static class HttpContextExtensions
///
/// Get the value in the request form or query string for the key
///
- public static string? GetRequestValue(this HttpContext context, string key)
+ public static string GetRequestValue(this HttpContext context, string key)
{
HttpRequest request = context.Request;
if (!request.HasFormContentType)
@@ -73,7 +73,7 @@ public static class HttpContextExtensions
return request.Query[key];
}
- string? value = request.Form[key];
+ string value = request.Form[key];
return value ?? request.Query[key];
}
diff --git a/src/Umbraco.Web.Common/Extensions/TypeExtensions.cs b/src/Umbraco.Web.Common/Extensions/TypeExtensions.cs
deleted file mode 100644
index 60edea5b15..0000000000
--- a/src/Umbraco.Web.Common/Extensions/TypeExtensions.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Umbraco.Cms.Core.Models;
-using Umbraco.Cms.Core.Models.PublishedContent;
-
-namespace Umbraco.Extensions;
-
-internal static class TypeExtensions
-{
- public static bool IsRenderingModel(this Type type)
- => typeof(ContentModel).IsAssignableFrom(type) || typeof(IPublishedContent).IsAssignableFrom(type);
-}
diff --git a/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs b/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs
index 74339bac43..cf73ba481c 100644
--- a/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs
+++ b/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs
@@ -52,6 +52,41 @@ public class UmbracoRequestMiddleware : IMiddleware
private readonly IVariationContextAccessor _variationContextAccessor;
private SmidgeOptions _smidgeOptions;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ // Obsolete, scheduled for removal in V11
+ [Obsolete("Use constructor that takes an IOptions")]
+ public UmbracoRequestMiddleware(
+ ILogger logger,
+ IUmbracoContextFactory umbracoContextFactory,
+ IRequestCache requestCache,
+ IEventAggregator eventAggregator,
+ IProfiler profiler,
+ IHostingEnvironment hostingEnvironment,
+ UmbracoRequestPaths umbracoRequestPaths,
+ BackOfficeWebAssets backOfficeWebAssets,
+ IOptionsMonitor smidgeOptions,
+ IRuntimeState runtimeState,
+ IVariationContextAccessor variationContextAccessor,
+ IDefaultCultureAccessor defaultCultureAccessor)
+ : this(
+ logger,
+ umbracoContextFactory,
+ requestCache,
+ eventAggregator,
+ profiler,
+ hostingEnvironment,
+ umbracoRequestPaths,
+ backOfficeWebAssets,
+ smidgeOptions,
+ runtimeState,
+ variationContextAccessor,
+ defaultCultureAccessor,
+ StaticServiceProvider.Instance.GetRequiredService>())
+ {
+ }
+
///
/// Initializes a new instance of the class.
///
diff --git a/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs b/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs
index eb4991fec3..246e313b9a 100644
--- a/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs
+++ b/src/Umbraco.Web.Common/Mvc/UmbracoMvcConfigureOptions.cs
@@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Web.Common.Filters;
using Umbraco.Cms.Web.Common.ModelBinders;
-using Umbraco.Cms.Web.Common.Validators;
namespace Umbraco.Cms.Web.Common.Mvc;
@@ -19,8 +18,6 @@ public class UmbracoMvcConfigureOptions : IConfigureOptions
public void Configure(MvcOptions options)
{
options.ModelBinderProviders.Insert(0, new ContentModelBinderProvider());
- options.ModelValidatorProviders.Insert(0, new BypassRenderingModelValidatorProvider());
- options.ModelMetadataDetailsProviders.Add(new BypassRenderingModelValidationMetadataProvider());
options.Filters.Insert(0, new EnsurePartialViewMacroViewContextFilterAttribute());
}
}
diff --git a/src/Umbraco.Web.Common/Routing/RoutableDocumentFilter.cs b/src/Umbraco.Web.Common/Routing/RoutableDocumentFilter.cs
index 4abbb21cb3..44fa64b274 100644
--- a/src/Umbraco.Web.Common/Routing/RoutableDocumentFilter.cs
+++ b/src/Umbraco.Web.Common/Routing/RoutableDocumentFilter.cs
@@ -70,7 +70,7 @@ public sealed class RoutableDocumentFilter : IRoutableDocumentFilter
return maybeDoc;
}
- private void EndpointsChanged(object? value)
+ private void EndpointsChanged(object value)
{
lock (_routeLocker)
{
diff --git a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
index b06f8d0688..362910e7e4 100644
--- a/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
+++ b/src/Umbraco.Web.Common/RuntimeMinification/SmidgeRuntimeMinifier.cs
@@ -157,6 +157,14 @@ public class SmidgeRuntimeMinifier : IRuntimeMinifier
}
}
+ ///
+ [Obsolete("Invalidation is handled automatically. Scheduled for removal V11.")]
+ public void Reset()
+ {
+ var version = DateTime.UtcNow.Ticks.ToString();
+ _configManipulator.SaveConfigValue(Core.Constants.Configuration.ConfigRuntimeMinificationVersion, version);
+ }
+
private BundleEnvironmentOptions ConfigureBundleEnvironmentOptions(BundlingOptions bundleOptions)
{
var bundleEnvironmentOptions = new BundleEnvironmentOptions();
diff --git a/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs b/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
index 352136504e..09793081cf 100644
--- a/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
+++ b/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
@@ -90,7 +90,7 @@ public class BackOfficeUserManager : UmbracoUserManager ChangePasswordWithResetAsync(string userId, string token, string newPassword)
+ public override async Task ChangePasswordWithResetAsync(string userId, string token, string? newPassword)
{
IdentityResult result = await base.ChangePasswordWithResetAsync(userId, token, newPassword);
if (result.Succeeded)
@@ -101,7 +101,7 @@ public class BackOfficeUserManager : UmbracoUserManager ChangePasswordAsync(BackOfficeIdentityUser user, string currentPassword, string newPassword)
+ public override async Task ChangePasswordAsync(BackOfficeIdentityUser user, string? currentPassword, string? newPassword)
{
IdentityResult result = await base.ChangePasswordAsync(user, currentPassword, newPassword);
if (result.Succeeded)
diff --git a/src/Umbraco.Web.Common/Security/ConfigureIISServerOptions.cs b/src/Umbraco.Web.Common/Security/ConfigureIISServerOptions.cs
new file mode 100644
index 0000000000..fe29d86f51
--- /dev/null
+++ b/src/Umbraco.Web.Common/Security/ConfigureIISServerOptions.cs
@@ -0,0 +1,22 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
+
+namespace Umbraco.Cms.Web.Common.Security;
+
+[Obsolete(
+ "This class is obsolete, as this does not configure your Maximum request length, see https://our.umbraco.com/documentation/Reference/V9-Config/MaximumUploadSizeSettings/ for information about configuring maximum request length")]
+public class ConfigureIISServerOptions : IConfigureOptions
+{
+ private readonly IOptions _runtimeSettings;
+
+ public ConfigureIISServerOptions(IOptions runtimeSettings) =>
+ _runtimeSettings = runtimeSettings;
+
+ public void Configure(IISServerOptions options) =>
+
+ // convert from KB to bytes
+ options.MaxRequestBodySize = _runtimeSettings.Value.MaxRequestLength.HasValue
+ ? _runtimeSettings.Value.MaxRequestLength.Value * 1024
+ : uint.MaxValue; // ~4GB is the max supported value for IIS and IIS express.
+}
diff --git a/src/Umbraco.Web.Common/Security/ConfigureMemberCookieOptions.cs b/src/Umbraco.Web.Common/Security/ConfigureMemberCookieOptions.cs
index 5bf7a98749..1e0960fbc7 100644
--- a/src/Umbraco.Web.Common/Security/ConfigureMemberCookieOptions.cs
+++ b/src/Umbraco.Web.Common/Security/ConfigureMemberCookieOptions.cs
@@ -18,7 +18,7 @@ public sealed class ConfigureMemberCookieOptions : IConfigureNamedOptions
{
- ClaimsIdentity? newIdentity = refreshingPrincipal.NewPrincipal?.Identities.First();
- ClaimsIdentity? currentIdentity = refreshingPrincipal.CurrentPrincipal?.Identities.First();
+ ClaimsIdentity newIdentity = refreshingPrincipal.NewPrincipal.Identities.First();
+ ClaimsIdentity currentIdentity = refreshingPrincipal.CurrentPrincipal.Identities.First();
- if (currentIdentity is not null)
- {
- // Since this is refreshing an existing principal, we want to merge all claims.
- newIdentity?.MergeAllClaims(currentIdentity);
- }
+ // Since this is refreshing an existing principal, we want to merge all claims.
+ newIdentity.MergeAllClaims(currentIdentity);
return Task.CompletedTask;
};
diff --git a/src/Umbraco.Web.Common/Security/IBackOfficeSignInManager.cs b/src/Umbraco.Web.Common/Security/IBackOfficeSignInManager.cs
index f76912743b..8e674c8b9f 100644
--- a/src/Umbraco.Web.Common/Security/IBackOfficeSignInManager.cs
+++ b/src/Umbraco.Web.Common/Security/IBackOfficeSignInManager.cs
@@ -19,7 +19,7 @@ public interface IBackOfficeSignInManager
Task