Unbreak breaking changes

This commit is contained in:
Bjarke Berg
2021-12-15 11:47:45 +01:00
parent 908c89f4b3
commit d41fca73a1
8 changed files with 48 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
@@ -28,5 +29,14 @@ namespace Umbraco.Cms.Core.Models.ContentEditing
/// </summary>
[DataMember(Name = "permissions")]
public IDictionary<int, IEnumerable<string>> AssignedPermissions { get; set; }
[Obsolete("This is not used and will be removed in Umbraco 10")]
public IEnumerable<ValidationResult> 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" });
}
}
}
}

View File

@@ -279,7 +279,6 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
return builder;
}
public static IUmbracoBuilder AddCoreNotifications(this IUmbracoBuilder builder)
{
// add handlers for sending user notifications (i.e. emails)

View File

@@ -24,9 +24,20 @@ namespace Umbraco.Extensions
/// Such as adding ProcessID, Thread, AppDomain etc
/// It is highly recommended that you keep/use this default in your own logging config customizations
/// </summary>
/// <param name="logConfig">A Serilog LoggerConfiguration</param>
/// <param name="hostingEnvironment"></param>
/// <param name="loggingConfiguration"></param>
public static LoggerConfiguration MinimalConfiguration(
this LoggerConfiguration logConfig,
IHostingEnvironment hostingEnvironment,
ILoggingConfiguration loggingConfiguration,
IConfiguration configuration)
{
return MinimalConfiguration(logConfig, hostingEnvironment, loggingConfiguration, configuration, out _);
}
/// <summary>
/// This configures Serilog with some defaults
/// Such as adding ProcessID, Thread, AppDomain etc
/// It is highly recommended that you keep/use this default in your own logging config customizations
/// </summary>
public static LoggerConfiguration MinimalConfiguration(
this LoggerConfiguration logConfig,
IHostingEnvironment hostingEnvironment,

View File

@@ -21,6 +21,14 @@ namespace Umbraco.Cms.Core.Logging.Serilog
SerilogLog = logConfig.CreateLogger();
}
public static SerilogLogger CreateWithDefaultConfiguration(
IHostingEnvironment hostingEnvironment,
ILoggingConfiguration loggingConfiguration,
IConfiguration configuration)
{
return CreateWithDefaultConfiguration(hostingEnvironment, loggingConfiguration, configuration, out _);
}
/// <summary>
/// Creates a logger with some pre-defined configuration and remainder from config file
/// </summary>

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Serilog.Events;
@@ -43,11 +43,6 @@ namespace Umbraco.Cms.Core.Logging.Viewer
bool CheckCanOpenLogs(LogTimePeriod logTimePeriod);
/// <summary>
/// Get the Serilog minimum-level and UmbracoFile-level values from the config file.
/// </summary>
ReadOnlyDictionary<string, LogEventLevel> GetLogLevels();
/// <summary>
/// Gets the current Serilog minimum log level
/// </summary>

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

View File

@@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Serilog.Events;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Logging.Viewer;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Web.Common.Attributes;
using Umbraco.Cms.Web.Common.Authorization;
using Umbraco.Cms.Web.Common.DependencyInjection;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Web.BackOffice.Controllers
@@ -22,10 +24,19 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
public class LogViewerController : BackOfficeNotificationsController
{
private readonly ILogViewer _logViewer;
private readonly ILogLevelLoader _logLevelLoader;
[Obsolete]
public LogViewerController(ILogViewer logViewer)
: this(logViewer, StaticServiceProvider.Instance.GetRequiredService<ILogLevelLoader>())
{
}
public LogViewerController(ILogViewer logViewer, ILogLevelLoader logLevelLoader)
{
_logViewer = logViewer ?? throw new ArgumentNullException(nameof(logViewer));
_logLevelLoader = logLevelLoader ?? throw new ArgumentNullException(nameof(logLevelLoader));
}
private bool CanViewLogs(LogTimePeriod logTimePeriod)
@@ -140,7 +151,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
[HttpGet]
public ReadOnlyDictionary<string, LogEventLevel> GetLogLevels()
{
return _logViewer.GetLogLevels();
return _logLevelLoader.GetLogLevelsFromSinks();
}
[Obsolete("Please use GetLogLevels() instead. Scheduled for removal in V11.")]