diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 74e488206e..a3ffc10a1d 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -31,7 +31,8 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
- dotnet-version: '6.0.x'
+ dotnet-version: '7.x'
+ include-prerelease: true
- name: dotnet build
run: dotnet build umbraco.sln -c SkipTests
diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml
index ae8ca25f52..606e0b6a67 100644
--- a/build/azure-pipelines.yml
+++ b/build/azure-pipelines.yml
@@ -64,6 +64,11 @@ 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:
@@ -130,41 +135,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:
@@ -192,14 +197,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
@@ -228,10 +233,10 @@ stages:
artifact: build_output
path: $(Build.SourcesDirectory)
- task: UseDotNet@2
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) # net6 already on the other images
- displayName: Use net6
+ displayName: Use net7
inputs:
- version: 6.x
+ version: 7.x
+ includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: Run dotnet test
inputs:
@@ -264,10 +269,10 @@ stages:
artifact: build_output
path: $(Build.SourcesDirectory)
- task: UseDotNet@2
- displayName: Use net6
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) # net6 already on the other images
+ displayName: Use net7
inputs:
- version: 6.x
+ version: 7.x
+ includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: Run dotnet test
inputs:
@@ -305,7 +310,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
@@ -327,7 +332,7 @@ stages:
displayName: E2E Tests
dependsOn: Build
jobs:
- # E2E Tests
+ # E2E Tests
- job:
displayName: E2E Tests
variables:
@@ -358,7 +363,7 @@ stages:
Windows:
vmImage: 'windows-latest'
pool:
- vmImage: $(vmImage)
+ vmImage: $(vmImage)
steps:
- task: DownloadPipelineArtifact@2
displayName: Download nupkg
@@ -397,7 +402,12 @@ 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'))
- # Linux containers smooth
+ - task: UseDotNet@2
+ displayName: Use .Net 7.x
+ inputs:
+ version: 7.x
+ includePreviewVersions: true
+ # Linux containers smooth
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
displayName: Build & run container (Linux only)
@@ -482,14 +492,17 @@ stages:
inputs:
artifact: nupkg
path: $(Build.ArtifactStagingDirectory)/nupkg
- - task: NuGetCommand@2
- displayName: Nuget push
+ - task: DotNetCoreCLI@2
+ displayName: dotnet restore
inputs:
- command: 'push'
- packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
- nuGetFeedType: 'external'
- publishFeedCredentials: 'MyGet - Pre-releases'
-
+ command: restore
+ projects: '**/umbraco.sln'
+ # TODO: Use NuGetCommand instead of DotNetCoreCLI
+ # - task: NuGetCommand@2
+ # displayName: Restore NuGet Packages
+ # inputs:
+ # restoreSolution: 'umbraco.sln'
+ # feedsToUse: config
- stage: Deploy_NuGet
displayName: NuGet release
dependsOn:
@@ -506,13 +519,11 @@ stages:
inputs:
artifact: nupkg
path: $(Build.ArtifactStagingDirectory)/nupkg
- - task: NuGetCommand@2
- displayName: Nuget push
+ - task: DotNetCoreCLI@2
+ displayName: dotnet restore
inputs:
- command: 'push'
- packagesToPush: $(Build.ArtifactStagingDirectory)/**/*.nupkg
- nuGetFeedType: 'external'
- publishFeedCredentials: 'NuGet - Umbraco.*'
+ command: restore
+ projects: '**/umbraco.sln'
- stage: Upload_API_Docs
pool:
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index ce54e08edd..657774fcc0 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
- 10.0
+ preview
en-US
Umbraco CMS
Copyright © Umbraco 2021
@@ -44,10 +44,11 @@
-
- true
- 10.0.0
- true
- true
-
+
+
+
+
+
+
+
diff --git a/src/JsonSchema/JsonSchema.csproj b/src/JsonSchema/JsonSchema.csproj
index 551d96f1fb..8fa11a4bee 100644
--- a/src/JsonSchema/JsonSchema.csproj
+++ b/src/JsonSchema/JsonSchema.csproj
@@ -1,7 +1,7 @@
Exe
- net6.0
+ net7.0
true
false
false
diff --git a/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs b/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
index f0921f2244..1f57d99e4a 100644
--- a/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
+++ b/src/Umbraco.Cms.ManagementApi/ManagementApiComposer.cs
@@ -62,9 +62,10 @@ 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.TrimStart(Constants.CharArrays.TildeForwardSlash);
+ var backofficePath = (globalSettings?.UmbracoPath ?? new 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 2fd111bfa8..a3a34e178b 100644
--- a/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj
+++ b/src/Umbraco.Cms.ManagementApi/Umbraco.Cms.ManagementApi.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.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 e206cd8653..e78c210ae2 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 @@
- net6.0
+ net7.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 5aa062df17..943757b353 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 @@
- net6.0
+ net7.0
Umbraco.Cms.Persistence.Sqlite
Umbraco.Cms.Persistence.Sqlite
Adds support for SQLite to Umbraco CMS.
@@ -12,6 +12,7 @@
+
diff --git a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
index 1fbbd8c42f..89cb8a44aa 100644
--- a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
+++ b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.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 c6c63108ff..ce43dc67fc 100644
--- a/src/Umbraco.Cms/Umbraco.Cms.csproj
+++ b/src/Umbraco.Cms/Umbraco.Cms.csproj
@@ -1,6 +1,6 @@
- net6.0
+ net7.0
false
Umbraco.Cms
Umbraco.Cms
diff --git a/src/Umbraco.Core/Composing/IUserComposer.cs b/src/Umbraco.Core/Composing/IUserComposer.cs
deleted file mode 100644
index a3e45054f8..0000000000
--- a/src/Umbraco.Core/Composing/IUserComposer.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-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 cd256e1b45..69ef69239e 100644
--- a/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs
+++ b/src/Umbraco.Core/Configuration/ConfigureConnectionStrings.cs
@@ -23,8 +23,13 @@ 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 0c5d39f47a..672577b1b7 100644
--- a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs
@@ -19,30 +19,36 @@ 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 = "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 },
+ 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 = "-" },
};
///
@@ -73,13 +79,6 @@ 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 0798014600..5062dc87e4 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 32ad130c33..f78ce306dd 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 ac0e1651ea..2b55afdcb0 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 4a1872cf30..8515fc3cc4 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 e262de76e7..473224553a 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 7b221e1435..22acf8cc4d 100644
--- a/src/Umbraco.Core/Constants-Conventions.cs
+++ b/src/Umbraco.Core/Constants-Conventions.cs
@@ -178,68 +178,6 @@ 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 ec26080e76..579a34894a 100644
--- a/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs
+++ b/src/Umbraco.Core/DependencyInjection/ServiceCollectionExtensions.cs
@@ -68,16 +68,7 @@ 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 c409a849ec..fc78d985f7 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.CollectionBuilders.cs
@@ -84,12 +84,8 @@ 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 c699e09743..280d7ce492 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
@@ -272,14 +272,6 @@ 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 6efd096c68..31ef06c400 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
@@ -103,8 +103,6 @@ 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 4bfe7fd7bd..d806950584 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
@@ -307,7 +307,6 @@ 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 3aa124d2f3..c88a2d8b2f 100644
--- a/src/Umbraco.Core/Extensions/EnumExtensions.cs
+++ b/src/Umbraco.Core/Extensions/EnumExtensions.cs
@@ -1,42 +1,31 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
-namespace Umbraco.Extensions;
+using System;
-///
-/// Provides extension methods to .
-///
-public static class EnumExtensions
+namespace Umbraco.Extensions
{
///
- /// Determines whether all the flags/bits are set within the enum value.
+ /// Provides extension methods to .
///
- /// 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);
-
- ///
- /// 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
+ public static class EnumExtensions
{
- var v = Convert.ToUInt64(value);
- var f = Convert.ToUInt64(flags);
+ ///
+ /// 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;
+ return (v & f) > 0;
+ }
}
}
diff --git a/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs b/src/Umbraco.Core/Extensions/RequestHandlerSettingsExtension.cs
index 475f093785..8699950b37 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,31 +28,8 @@ public static class RequestHandlerSettingsExtension
return 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;
+ /// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection.
+ return MergeUnique(requestHandlerSettings.UserDefinedCharCollection, RequestHandlerSettings.DefaultCharCollection);
}
private static IEnumerable GetReplacements(IConfiguration configuration, string key)
@@ -64,6 +41,12 @@ 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 });
}
@@ -71,8 +54,7 @@ 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 5e830e1f61..9a0ecf57ae 100644
--- a/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs
+++ b/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs
@@ -19,18 +19,6 @@ 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 b8960048f6..1dfa72039c 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 e2502e4669..e68101918a 100644
--- a/src/Umbraco.Core/IO/ViewHelper.cs
+++ b/src/Umbraco.Core/IO/ViewHelper.cs
@@ -11,21 +11,11 @@ public class ViewHelper : IViewHelper
private readonly IDefaultViewContentProvider _defaultViewContentProvider;
private readonly IFileSystem _viewFileSystem;
- [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 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 6db33486f5..17b89d8ec0 100644
--- a/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
+++ b/src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
@@ -29,20 +29,11 @@ public class TelemetryIdentifierStep : InstallSetupStep
[DataMember(Name = "newPassword")]
- public string? NewPassword { get; set; }
+ public required 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 1c04496e04..1e648f949f 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,13 +22,4 @@ 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 f4fe617a83..c31f5f72ff 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, IContentTypeWithHistoryCleanup
+public class ContentType : ContentTypeCompositionBase, IContentType
{
public const bool SupportsPublishingConst = true;
diff --git a/src/Umbraco.Core/Models/IContentType.cs b/src/Umbraco.Core/Models/IContentType.cs
index 5d76c49b88..f43764faeb 100644
--- a/src/Umbraco.Core/Models/IContentType.cs
+++ b/src/Umbraco.Core/Models/IContentType.cs
@@ -2,19 +2,6 @@ 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
///
@@ -68,4 +55,10 @@ 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 9299665755..2072533917 100644
--- a/src/Umbraco.Core/Models/Language.cs
+++ b/src/Umbraco.Core/Models/Language.cs
@@ -29,22 +29,14 @@ public class Language : EntityBase, ILanguage
_cultureName = cultureName ?? throw new ArgumentNullException(nameof(cultureName));
}
- [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
+ ///
+ [DataMember]
+ public string IsoCode
{
- ArgumentNullException.ThrowIfNull(value);
+ get => _isoCode;
+ set
+ {
+ 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 5829512648..5d35e3a32a 100644
--- a/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs
+++ b/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs
@@ -1,5 +1,4 @@
using System.Globalization;
-using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
@@ -10,7 +9,6 @@ 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;
@@ -34,48 +32,12 @@ public class ContentTypeMapDefinition : IMapDefinition
private readonly IShortStringHelper _shortStringHelper;
private ContentSettings _contentSettings;
- [Obsolete("Use ctor with all params injected")]
- public ContentTypeMapDefinition(
- CommonMapper commonMapper,
- PropertyEditorCollection propertyEditors,
- IDataTypeService dataTypeService,
- IFileService fileService,
- IContentTypeService contentTypeService,
- IMediaTypeService mediaTypeService,
+ public ContentTypeMapDefinition(CommonMapper commonMapper, PropertyEditorCollection propertyEditors,
+ IDataTypeService dataTypeService, IFileService fileService,
+ IContentTypeService contentTypeService, IMediaTypeService mediaTypeService,
IMemberTypeService memberTypeService,
- 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)
+ ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IOptions globalSettings,
+ IHostingEnvironment hostingEnvironment, IOptionsMonitor contentSettings)
{
_commonMapper = commonMapper;
_propertyEditors = propertyEditors;
@@ -94,32 +56,6 @@ 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(
@@ -171,7 +107,52 @@ public class ContentTypeMapDefinition : IMapDefinition
(source, context) => new MemberPropertyTypeDisplay(), Map);
}
- private static void MapHistoryCleanup(DocumentTypeSave source, IContentTypeWithHistoryCleanup target)
+ 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)
{
// If source history cleanup is null we don't have to map all properties
if (source.HistoryCleanup is null)
@@ -247,28 +228,6 @@ 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)
{
@@ -303,7 +262,7 @@ public class ContentTypeMapDefinition : IMapDefinition
{
MapTypeToDisplayBase(source, target);
- if (source is IContentTypeWithHistoryCleanup sourceWithHistoryCleanup)
+ if (source is IContentType sourceWithHistoryCleanup)
{
target.HistoryCleanup = new HistoryCleanupViewModel
{
@@ -316,7 +275,7 @@ public class ContentTypeMapDefinition : IMapDefinition
_contentSettings.ContentVersionCleanupPolicy.KeepAllVersionsNewerThanDays,
GlobalKeepLatestVersionPerDayForDays =
_contentSettings.ContentVersionCleanupPolicy.KeepLatestVersionPerDayForDays,
- GlobalEnableCleanup = _contentSettings.ContentVersionCleanupPolicy.EnableCleanup,
+ GlobalEnableCleanup = _contentSettings.ContentVersionCleanupPolicy.EnableCleanup
};
}
@@ -495,7 +454,8 @@ 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)
{
@@ -936,7 +896,8 @@ 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 e1550971e1..3c79d1c12f 100644
--- a/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs
+++ b/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs
@@ -15,11 +15,6 @@ 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;
@@ -30,9 +25,7 @@ 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 ae9876628f..65db6181dd 100644
--- a/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs
+++ b/src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs
@@ -70,7 +70,8 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper
return resolved;
}
- [Obsolete("Use MapMembershipProperties. Will be removed in Umbraco 10.")]
+ // We need this because we call GetCustomGenericProperties from TabsAndPropertiesMapper
+ // and we have no access to MapMembershipProperties from the base class without casting
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 bd5e7af0a4..aeee722ed2 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs
@@ -56,21 +56,6 @@ 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.
///
@@ -85,15 +70,6 @@ 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 d48e802c6e..519885b7fa 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,14 +22,7 @@ public class RelationType : EntityBase, IRelationTypeWithIsDependency
{
}
- [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)
- {
+ 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 c73fd73eb3..29d318f8ff 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 string? Code { get; set; }
+ public required string Code { get; set; }
[Required]
[DataMember(Name = "provider", IsRequired = true)]
- public string? Provider { get; set; }
+ public required 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 57d1abc38f..58803c101d 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 string? Password { get; set; }
+ public required string Password { get; set; }
[Required]
[DataMember(Name = "resetCode", IsRequired = true)]
- public string? ResetCode { get; set; }
+ public required string ResetCode { get; set; }
}
diff --git a/src/Umbraco.Core/Models/UnLinkLoginModel.cs b/src/Umbraco.Core/Models/UnLinkLoginModel.cs
index c121230810..ba4d881b73 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 string? LoginProvider { get; set; }
+ public required string LoginProvider { get; set; }
[Required]
[DataMember(Name = "providerKey", IsRequired = true)]
- public string? ProviderKey { get; set; }
+ public required string ProviderKey { get; set; }
}
diff --git a/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs b/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs
deleted file mode 100644
index 036d5cf8a4..0000000000
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationComponentsInstallingNotification.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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
deleted file mode 100644
index 2bbab6e7ec..0000000000
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationMainDomAcquiredNotification.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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 7c7e97f29f..49eaac02f2 100644
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationStartingNotification.cs
@@ -2,32 +2,21 @@ namespace Umbraco.Cms.Core.Notifications;
///
/// Notification that occurs at the very end of the Umbraco boot process (after all s are
-/// initialized).
-///
-///
-public class UmbracoApplicationStartingNotification : IUmbracoApplicationLifetimeNotification
-{
- ///
- /// Initializes a new instance of the class.
+/// initialized).
///
- /// The runtime level
- [Obsolete("Use ctor with all params")]
- public UmbracoApplicationStartingNotification(RuntimeLevel runtimeLevel)
- : this(runtimeLevel, false)
+ ///
+ public class UmbracoApplicationStartingNotification : IUmbracoApplicationLifetimeNotification
{
- // 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;
- }
+ ///
+ /// 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 a877bd3162..8face75954 100644
--- a/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs
+++ b/src/Umbraco.Core/Notifications/UmbracoApplicationStoppingNotification.cs
@@ -1,26 +1,17 @@
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
- }
///
- /// Initializes a new instance of the class.
+ /// Notification that occurs when Umbraco is shutting down (after all s are terminated).
///
- /// Indicates whether Umbraco is restarting.
- public UmbracoApplicationStoppingNotification(bool isRestarting) => IsRestarting = isRestarting;
+ ///
+ public class UmbracoApplicationStoppingNotification : IUmbracoApplicationLifetimeNotification
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// 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
deleted file mode 100644
index 6d7370768c..0000000000
--- a/src/Umbraco.Core/Persistence/Repositories/IExternalLoginRepository.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-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 9d2fe0ecbf..136abec3c4 100644
--- a/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/IMacroRepository.cs
@@ -1,8 +1,11 @@
-using Umbraco.Cms.Core.Models;
+using Umbraco.Cms.Core.Models;
namespace Umbraco.Cms.Core.Persistence.Repositories;
public interface IMacroRepository : IReadWriteQueryRepository, IReadRepository
{
- // IEnumerable GetAll(params string[] aliases);
+ IMacro? GetByAlias(string alias);
+
+ IEnumerable GetAllByAlias(string[] aliases);
+
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs
deleted file mode 100644
index 48ead78759..0000000000
--- a/src/Umbraco.Core/Persistence/Repositories/IMacroWithAliasRepository.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-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 58475f802d..32c04bdb4b 100644
--- a/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/IMemberRepository.cs
@@ -38,20 +38,4 @@ 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 893a3c248e..35458d6eba 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,14 +13,6 @@ 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 d73eb5a2eb..2e26894d23 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 d0a238dbb2..6506d29725 100644
--- a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs
+++ b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs
@@ -24,37 +24,20 @@ public class DefaultUrlProvider : IUrlProvider
private readonly UriUtility _uriUtility;
private RequestHandlerSettings _requestSettings;
- [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;
+ 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 0a744f3f0f..60ad1f10ba 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 IContentTypeWithHistoryCleanup withCleanup && withCleanup.HistoryCleanup is not null)
+ if (contentType is IContentType 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 677108dbcd..061e0b93aa 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, IExternalLoginService, IExternalLoginWithKeyService
+public class ExternalLoginService : RepositoryService, IExternalLoginWithKeyService
{
private readonly IExternalLoginWithKeyRepository _externalLoginRepository;
@@ -21,37 +21,6 @@ public class ExternalLoginService : RepositoryService, IExternalLoginService, IE
: 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
deleted file mode 100644
index ba75d505ff..0000000000
--- a/src/Umbraco.Core/Services/IExternalLoginService.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-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 141b278d93..ef99248727 100644
--- a/src/Umbraco.Core/Services/IMacroService.cs
+++ b/src/Umbraco.Core/Services/IMacroService.cs
@@ -49,5 +49,12 @@ public interface IMacroService : IService
/////
///// Alias to retrieve an for
///// An object
- // IMacroPropertyType GetMacroPropertyTypeByAlias(string alias);
+ //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);
}
diff --git a/src/Umbraco.Core/Services/IMacroWithAliasService.cs b/src/Umbraco.Core/Services/IMacroWithAliasService.cs
deleted file mode 100644
index 508168b877..0000000000
--- a/src/Umbraco.Core/Services/IMacroWithAliasService.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-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 dc96535f8b..553441f572 100644
--- a/src/Umbraco.Core/Services/IMembershipMemberService.cs
+++ b/src/Umbraco.Core/Services/IMembershipMemberService.cs
@@ -128,20 +128,6 @@ 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 d0509a9283..0a0cc751d5 100644
--- a/src/Umbraco.Core/Services/ITwoFactorLoginService.cs
+++ b/src/Umbraco.Core/Services/ITwoFactorLoginService.cs
@@ -52,15 +52,17 @@ 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);
-}
-[Obsolete("This will be merged into ITwoFactorLoginService in Umbraco 11")]
-public interface ITwoFactorLoginService2 : ITwoFactorLoginService
-{
+ ///
+ /// Disables 2FA with Code.
+ ///
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 839e52f49e..1634f60baa 100644
--- a/src/Umbraco.Core/Services/LocalizedTextService.cs
+++ b/src/Umbraco.Core/Services/LocalizedTextService.cs
@@ -64,27 +64,16 @@ public class LocalizedTextService : ILocalizedTextService
XmlSourceToNoAreaDictionary(source));
}
- [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 =
+ ///
+ /// 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 73889895e2..be07d1ef02 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, IMacroWithAliasService
+internal class MacroService : RepositoryService, IMacroService
{
private readonly IAuditRepository _auditRepository;
private readonly IMacroRepository _macroRepository;
@@ -34,7 +34,7 @@ internal class MacroService : RepositoryService, IMacroWithAliasService
/// An object
public IMacro? GetByAlias(string alias)
{
- if (_macroRepository is not IMacroWithAliasRepository macroWithAliasRepository)
+ if (_macroRepository is not IMacroRepository macroWithAliasRepository)
{
return GetAll().FirstOrDefault(x => x.Alias == alias);
}
@@ -65,7 +65,7 @@ internal class MacroService : RepositoryService, IMacroWithAliasService
public IEnumerable GetAll(params string[] aliases)
{
- if (_macroRepository is not IMacroWithAliasRepository macroWithAliasRepository)
+ if (_macroRepository is not IMacroRepository 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 76d730dc78..d8f9f787aa 100644
--- a/src/Umbraco.Core/Services/MemberService.cs
+++ b/src/Umbraco.Core/Services/MemberService.cs
@@ -728,11 +728,7 @@ namespace Umbraco.Cms.Core.Services
#region Save
- ///
- [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 SetLastLogin(string username, DateTime date) => throw new NotImplementedException();
///
public void Save(IMember member)
diff --git a/src/Umbraco.Core/Services/ServiceContext.cs b/src/Umbraco.Core/Services/ServiceContext.cs
index 0e24f27be5..9def2bd8fa 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 IExternalLoginService? ExternalLoginService => _externalLoginService?.Value;
+ public IExternalLoginWithKeyService? ExternalLoginService => _externalLoginService?.Value;
///
/// Gets the RedirectUrlService.
@@ -257,7 +257,7 @@ public class ServiceContext
IDomainService? domainService = null,
IMacroService? macroService = null,
IPublicAccessService? publicAccessService = null,
- IExternalLoginService? externalLoginService = null,
+ IExternalLoginWithKeyService? 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 de79284ac9..acbdded1c9 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 : ITwoFactorLoginService2
+public class TwoFactorLoginService : ITwoFactorLoginService
{
private readonly IOptions _backOfficeIdentityOptions;
private readonly IOptions _identityOptions;
@@ -39,23 +39,6 @@ public class TwoFactorLoginService : ITwoFactorLoginService2
_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 88e2708b2c..69e6351fbd 100644
--- a/src/Umbraco.Core/Services/UserService.cs
+++ b/src/Umbraco.Core/Services/UserService.cs
@@ -333,13 +333,8 @@ 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 01183739d5..8ee0b780b0 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.0
Umbraco.Cms.Core
Umbraco CMS
Umbraco.Cms.Core
@@ -15,6 +15,15 @@
+
+
+
+
+
+
+
+
+
@@ -30,7 +39,7 @@
-
+
all
diff --git a/src/Umbraco.Core/Web/IRequestAccessor.cs b/src/Umbraco.Core/Web/IRequestAccessor.cs
index a72ec5bc72..57940b3c1b 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 c6116e122f..813618738b 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,63 +39,45 @@ 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 e6306ab444..f7c3cf9a3e 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
- net6.0
+ net7.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 6d583151ba..1e17b959b6 100644
--- a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
+++ b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs
@@ -19,11 +19,6 @@ 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;
@@ -234,7 +229,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
{
@@ -269,7 +264,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 8b20a4725a..3afb9fe64a 100644
--- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
+++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
@@ -32,8 +32,7 @@ public static partial class UmbracoBuilderExtensions
builder.Services.AddUnique();
builder.Services.AddMultipleUnique();
builder.Services.AddUnique();
- builder.Services.AddUnique();
- builder.Services.AddUnique(factory => factory.GetRequiredService());
+ builder.Services.AddSingleton();
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 68b311f8cd..a08c5f1b59 100644
--- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs
+++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs
@@ -45,13 +45,6 @@ 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 bd69c7857c..d4a6265052 100644
--- a/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs
+++ b/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs
@@ -40,21 +40,11 @@ public class ReportSiteTask : RecurringHostedServiceBase
{
}
- [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)
- {
+ ///
+ /// 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 df1457d419..3fc763d92f 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,13 +39,6 @@ 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 9dae731af3..56efba4ca9 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,14 +14,6 @@ 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;
@@ -49,17 +41,6 @@ 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 3f12fd7d0d..8c1e0e2a54 100644
--- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
@@ -12,7 +12,6 @@ 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;
@@ -93,32 +92,20 @@ public class DatabaseSchemaCreator
private readonly ILoggerFactory _loggerFactory;
private readonly IUmbracoVersion _umbracoVersion;
- [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;
+ 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 6c28f08eb6..860ed870f7 100644
--- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreatorFactory.cs
@@ -1,11 +1,9 @@
-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;
@@ -20,30 +18,19 @@ public class DatabaseSchemaCreatorFactory
private readonly ILoggerFactory _loggerFactory;
private readonly IUmbracoVersion _umbracoVersion;
- [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 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 6e5e462d8d..f1369db5c3 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,17 +84,9 @@ public class AddTypedLabels : MigrationBase
.From()
.Where(x => x.DataTypeId == Constants.DataTypes.LabelString));
- 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 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 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 cec42492a3..3e3c2cfae1 100644
--- a/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
+++ b/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
@@ -1,3 +1,5 @@
+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;
@@ -42,8 +44,8 @@ public abstract class AutomaticPackageMigrationPlan : PackageMigrationPlan
MediaUrlGeneratorCollection mediaUrlGenerators,
IShortStringHelper shortStringHelper,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
- IMigrationContext context)
- : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context)
+ IMigrationContext context, IOptions options)
+ : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context, options)
{
}
diff --git a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs
index b4f49ab76b..192d1a51c3 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 IContentTypeWithHistoryCleanup withCleanup)
+ if (contentType is IContentType withCleanup)
{
UpdateHistoryCleanupPolicy(withCleanup, documentType.Element("HistoryCleanupPolicy"));
}
@@ -914,7 +914,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
return contentType;
}
- private void UpdateHistoryCleanupPolicy(IContentTypeWithHistoryCleanup withCleanup, XElement? element)
+ private void UpdateHistoryCleanupPolicy(IContentType withCleanup, XElement? element)
{
if (element == null)
{
diff --git a/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs b/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
index ae739c4361..6f0355f674 100644
--- a/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
+++ b/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs
@@ -1,5 +1,3 @@
-using System.ComponentModel;
-using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.IO;
@@ -7,7 +5,6 @@ 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;
@@ -41,36 +38,16 @@ public abstract class PackageMigrationBase : MigrationBase
_packageMigrationsSettings = 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));
+
- 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 fd7193e4ae..9e35999071 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 IContentTypeWithHistoryCleanup entityWithHistoryCleanup)
+ if (entity is IContentType 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 2207bdb16e..e49e2ffda9 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs
@@ -14,26 +14,13 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
-internal class ExternalLoginRepository : EntityRepositoryBase, IExternalLoginRepository, IExternalLoginWithKeyRepository
+internal class ExternalLoginRepository : EntityRepositoryBase, 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 323238084f..67fe818358 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, IMacroWithAliasRepository
+internal class MacroRepository : EntityRepositoryBase, IMacroRepository
{
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 02d1383bc3..200af7ad70 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberRepository.cs
@@ -202,13 +202,6 @@ 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 76eeb33821..86eba639ce 100644
--- a/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
+++ b/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
@@ -169,12 +169,9 @@ 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())
{
@@ -212,13 +209,8 @@ 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 9555482bbf..a6589166b2 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 2b9daab29f..b99eddba5d 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 244885887e..1908a3fbfc 100644
--- a/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
@@ -81,29 +81,6 @@ 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)
{
@@ -140,12 +117,17 @@ public class BackOfficeUserStore : UmbracoUserStore();
- var emptyPasswordValue = Constants.Security.EmptyPasswordPrefix +
+ if (user.Email is null || user.UserName is null)
+ {
+ throw new InvalidOperationException("Email and UserName is required.");
+ }
+
+ // 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)
@@ -278,16 +260,14 @@ 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((BackOfficeIdentityUser)null!);
+ return Task.FromResult(null);
}
BackOfficeIdentityUser? result = AssignLoginsCallback(_mapper.Map(user));
@@ -296,7 +276,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
+ protected override Task FindUserAsync(string userId, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
@@ -311,7 +291,7 @@ public class BackOfficeUserStore : UmbracoUserStore
- public override Task FindByEmailAsync(
+ public override Task FindByEmailAsync(
string email,
CancellationToken cancellationToken = default)
{
@@ -322,11 +302,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);
@@ -428,7 +408,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();
@@ -460,15 +440,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 is null || user.Id is null)
+ BackOfficeIdentityUser? user = await FindUserAsync(userId, cancellationToken);
+ if (user?.Id is null)
{
- return null!;
+ return null;
}
IList logins = await GetLoginsAsync(user, cancellationToken);
@@ -476,7 +456,7 @@ public class BackOfficeUserStore : UmbracoUserStore x.ProviderKey == providerKey && x.LoginProvider == loginProvider);
if (found == null)
{
- return null!;
+ return null;
}
return new IdentityUserLogin
@@ -489,7 +469,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();
@@ -497,11 +477,11 @@ public class BackOfficeUserStore : UmbracoUserStore)null!);
+ return Task.FromResult?>(null);
}
IIdentityUserLogin found = logins[0];
- return Task.FromResult(new IdentityUserLogin
+ return Task.FromResult?>(new IdentityUserLogin
{
LoginProvider = found.LoginProvider,
ProviderKey = found.ProviderKey,
@@ -511,30 +491,33 @@ public class BackOfficeUserStore : UmbracoUserStore
- protected override Task> FindRoleAsync(
+ protected override Task?> FindRoleAsync(
string normalizedRoleName,
CancellationToken cancellationToken)
{
IUserGroup? group = _userService.GetUserGroupByAlias(normalizedRoleName);
- if (group == null)
+ if (group?.Name is null)
{
- return Task.FromResult((IdentityRole)null!);
+ return Task.FromResult?>(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)
@@ -606,7 +589,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 05ab03b784..c914930e9e 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 fe34812334..714db070bb 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 eeeed4e4ec..b355bbcb18 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,23 +155,24 @@ 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();
@@ -185,36 +186,36 @@ 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))
{
- throw new ArgumentOutOfRangeException(nameof(roleId), $"{nameof(roleId)} is not a valid Guid");
- }
+ if (!Guid.TryParse(roleId, out Guid 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));
- }
+ if (string.IsNullOrWhiteSpace(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
- IMemberGroup? memberGroup = _memberGroupService.GetByName(name);
- return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup))!;
- }
+ 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 70efeeb739..bd52d43d8b 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((MemberIdentityUser)null!);
+ return Task.FromResult(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)
@@ -296,7 +294,7 @@ public class MemberUserStore : UmbracoUserStore
- public override Task FindByEmailAsync(
+ public override Task FindByEmailAsync(
string email,
CancellationToken cancellationToken = default)
{
@@ -307,11 +305,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();
@@ -326,7 +324,7 @@ public class MemberUserStore : UmbracoUserStore(user)))!;
@@ -446,7 +444,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();
@@ -462,38 +460,32 @@ public class MemberUserStore : UmbracoUserStore)null!);
+ return await Task.FromResult?>(null);
}
IList logins = await GetLoginsAsync(user, cancellationToken);
UserLoginInfo? found =
logins.FirstOrDefault(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider);
- if (found == null)
+ if (found is null)
{
- return await Task.FromResult((IdentityUserLogin)null!);
+ return await Task.FromResult?>(null);
}
- if (user.Id is not null)
+ return new IdentityUserLogin
{
- 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!;
+ LoginProvider = found.LoginProvider,
+ ProviderKey = found.ProviderKey,
+ // TODO: We don't store this value so it will be null
+ ProviderDisplayName = found.ProviderDisplayName,
+ UserId = user.Id
+ };
}
///
- protected override Task> FindUserLoginAsync(string loginProvider, string providerKey,
+ protected override Task?> FindUserLoginAsync(string loginProvider, string providerKey,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -512,11 +504,11 @@ public class MemberUserStore : UmbracoUserStore)null!);
+ return Task.FromResult?>(null);
}
IIdentityUserLogin found = logins[0];
- return Task.FromResult(new IdentityUserLogin
+ return Task.FromResult?>(new IdentityUserLogin
{
LoginProvider = found.LoginProvider,
ProviderKey = found.ProviderKey,
@@ -533,7 +525,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();
@@ -544,7 +536,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)
{
@@ -556,10 +548,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);
}
@@ -573,8 +565,7 @@ 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();
@@ -632,7 +623,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))
{
@@ -640,12 +631,12 @@ public class MemberUserStore : UmbracoUserStore x.Name == roleName);
- if (group == null)
+ if (group?.Name is null)
{
- return Task.FromResult((UmbracoIdentityRole)null!);
+ return Task.FromResult(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(),
@@ -653,27 +644,25 @@ 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 == null)
+ MemberIdentityUser? user = await FindUserAsync(userId, cancellationToken);
+ if (user is 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 != null)
+ if (user is not 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;
@@ -736,7 +725,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 671483fe7b..ade4fd1515 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 e38a0b89ab..af6e745f46 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;
- private string? _name;
+ private string _id = string.Empty;
+ private string _name = string.Empty;
- 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; set => base.Name = value; }
+ public override string? NormalizedName { get => base.Name ?? string.Empty; 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 bf79ab602d..7a44933e46 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 bc8b8078ca..dd3572c928 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
- if (user.HasIdentity == false)
+ // 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)
{
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 == null)
+ TUser? user = await FindByIdAsync(userId);
+ if (user is 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 == null)
+ TUser? user = await FindByNameAsync(username);
+ if (user is null)
{
return false;
}
diff --git a/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs b/src/Umbraco.Infrastructure/Security/UmbracoUserStore.cs
index 7a6c9d793a..35a8f2eea9 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 721e99bbd7..5257b2f141 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 IMacroWithAliasService macroWithAliasService)
+ if (_macroService is not IMacroService macroWithAliasService)
{
yield break;
}
diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
index 9676417cac..d8cd543dca 100644
--- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
+++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.0
Umbraco.Cms.Infrastructure
Umbraco.Cms.Infrastructure
Umbraco CMS Infrastructure
@@ -23,6 +23,11 @@
+
+
+
+
+
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 e7c38a23af..0e0cb355cb 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 @@
- net6.0
+ net7.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 27e27cc981..37a91d4599 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 @@
- net6.0
+ net7.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 0a923da01d..accb5fd82b 100644
--- a/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs
+++ b/src/Umbraco.New.Cms.Web.Common/Installer/SignInUserStep.cs
@@ -22,8 +22,12 @@ public class SignInUserStep : IInstallStep
public async Task ExecuteAsync(InstallData model)
{
- BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
- await _backOfficeSignInManager.SignInAsync(identityUser, false);
+ BackOfficeIdentityUser? identityUser = await _backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
+
+ if (identityUser is not null)
+ {
+ 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 159537c9d8..d9826126de 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 @@
- net6.0
+ net7.0
enable
enable
false
diff --git a/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs b/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
index 6f0360bba8..c47c04b548 100644
--- a/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
+++ b/src/Umbraco.PublishedCache.NuCache/ContentNodeKit.cs
@@ -1,22 +1,18 @@
-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
-{
- [Obsolete("This will be changed to a property in future versions")]
- public ContentNode Node = null!;
+ public struct ContentNodeKit
+ {
+ public ContentNode Node { get; } = null!;
- [Obsolete("This will be changed to a property in future versions")]
- public int ContentTypeId;
+ public int ContentTypeId { get; }
- [Obsolete("This will be changed to a property in future versions")]
- public ContentData? DraftData;
+ public ContentData? DraftData { get; }
- [Obsolete("This will be changed to a property in future versions")]
- public ContentData? PublishedData;
+ public ContentData? PublishedData { get; }
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 7e209cb97d..a7e0b60373 100644
--- a/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs
+++ b/src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs
@@ -1,30 +1,11 @@
-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
{
- // 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)
+ 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;
@@ -37,69 +18,19 @@ public class ContentData
CultureInfos = cultureInfos;
}
- public string Name
- {
- get;
- [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
- set;
- }
+ 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? 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;
- }
+ public IDictionary Properties { get; }
///
- /// 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;
- [Obsolete("Do not change this, use ctor with params and have this object immutable.")]
- set;
- }
+ public IReadOnlyDictionary? CultureInfos { get; }
}
+
diff --git a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
index 7b729d5097..4a2f763d36 100644
--- a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
+++ b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.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 390482276e..7704344d4e 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
@@ -186,11 +186,13 @@ public class AuthenticationController : UmbracoApiControllerBase
[ValidateAngularAntiForgeryToken]
public async Task PostUnLinkLogin(UnLinkLoginModel unlinkLoginModel)
{
- BackOfficeIdentityUser? user = await _userManager.FindByIdAsync(User.Identity?.GetUserId());
- if (user == null)
+ var userId = User.Identity?.GetUserId();
+ if (userId is null)
{
- throw new InvalidOperationException("Could not find user");
+ throw new InvalidOperationException("Could not find userId");
}
+ 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);
@@ -484,16 +486,19 @@ 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")
- {
- await _smsSender.SendSmsAsync(await _userManager.GetPhoneNumberAsync(user), 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")
+ {
+ var phoneNumber = await _userManager.GetPhoneNumberAsync(user);
+ if (phoneNumber is not null)
+ {
+ await _smsSender.SendSmsAsync(phoneNumber, message);
+ }
+ }
return Ok();
}
@@ -544,6 +549,10 @@ 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 c5567d1796..ae0b9c961f 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,9 +504,8 @@ public class BackOfficeController : UmbracoController
}
else if (result == SignInResult.TwoFactorRequired)
{
- BackOfficeIdentityUser? attemptedUser =
- await _userManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey);
- if (attemptedUser == null)
+ BackOfficeIdentityUser? attemptedUser = await _userManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey);
+ if (attemptedUser?.UserName is 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 6471b5b2ae..c8a3c710ec 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.PostChangePassword(new ChangingPasswordModel()))
+ controller => controller.PostSetAvatar(new List()))
},
{
"entityApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
@@ -416,7 +416,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"memberTypeApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
- controller => controller.GetAllTypes())
+ controller => controller.GetById(0))
},
{
"memberTypeQueryApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl(
diff --git a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
index f867ccc5a1..87f881ff69 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
@@ -81,47 +81,15 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
_userDataService = userDataService;
}
- [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
+ ///
+ /// 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();
@@ -230,12 +198,13 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[AllowAnonymous]
public async Task> PostSetInvitedUserPassword([FromBody] string newPassword)
{
- BackOfficeIdentityUser? user = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
- .BackOfficeSecurity?.GetUserId().ResultOr(0).ToString());
- if (user == null)
+ var userId = _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString();
+ if (userId is null)
{
- throw new InvalidOperationException("Could not find user");
+ throw new InvalidOperationException("Could not find user Id");
}
+ var user = await _backOfficeUserManager.FindByIdAsync(userId);
+ if (user == null) throw new InvalidOperationException("Could not find user");
IdentityResult result = await _backOfficeUserManager.AddPasswordAsync(user, newPassword);
@@ -335,8 +304,18 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[ValidateAngularAntiForgeryToken]
public async Task> GetCurrentUserLinkedLogins()
{
- BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
- .BackOfficeSecurity?.GetUserId().ResultOr(0).ToString(CultureInfo.InvariantCulture));
+ 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");
+ }
// 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 92779c18fa..ba9809f657 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
@@ -471,46 +471,6 @@ 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 6cb7f1f4bc..8dd599be46 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/HelpController.cs
@@ -18,12 +18,6 @@ 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 bb515b61fc..4cb7dc52fc 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
@@ -30,21 +30,13 @@ public class LanguageController : UmbracoAuthorizedJsonController
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
}
- [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 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 4c3cce59a5..7389af5112 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs
@@ -22,12 +22,6 @@ 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)
{
@@ -147,8 +141,4 @@ 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 50c54f420f..b81d120295 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs
@@ -986,37 +986,6 @@ 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 70f337f44f..b7220a3941 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,8 +513,12 @@ public class MemberController : ContentControllerBase
}
var needsResync = false;
-
- MemberIdentityUser identityMember = await _memberManager.FindByIdAsync(contentItem.Id?.ToString());
+ var memberId = contentItem.Id?.ToString();
+ if (memberId is null)
+ {
+ return ValidationProblem("Member was not found");
+ }
+ MemberIdentityUser? identityMember = await _memberManager.FindByIdAsync(memberId);
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 984cff0582..4184cc5798 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs
@@ -183,17 +183,6 @@ 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