diff --git a/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs b/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs index 551cbbc0ee..e782d69635 100644 --- a/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs +++ b/src/Umbraco.Core/Models/ContentEditing/UserGroupPermissionsSave.cs @@ -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 /// [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.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs index 0ec66bbaaa..f4a4866beb 100644 --- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs +++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs @@ -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) diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs index 85ebcc3b68..c4e8484307 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs @@ -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 /// - /// A Serilog LoggerConfiguration - /// - /// + public static LoggerConfiguration MinimalConfiguration( + this LoggerConfiguration logConfig, + IHostingEnvironment hostingEnvironment, + ILoggingConfiguration loggingConfiguration, + IConfiguration configuration) + { + return MinimalConfiguration(logConfig, hostingEnvironment, loggingConfiguration, configuration, out _); + } + + /// + /// 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 + /// public static LoggerConfiguration MinimalConfiguration( this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs b/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs index 6c4df7e9fc..151f3e760c 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs @@ -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 _); + } + /// /// Creates a logger with some pre-defined configuration and remainder from config file /// diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs index c3c90ab9e9..4fed8ca9ab 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/ILogViewer.cs @@ -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); - /// - /// Get the Serilog minimum-level and UmbracoFile-level values from the config file. - /// - ReadOnlyDictionary GetLogLevels(); - /// /// Gets the current Serilog minimum log level /// diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs index cb45c7c738..d52d455fbc 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs index 954e9402e2..eafe4d1787 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogLogViewerSourceBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs b/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs index 766cf89ea1..03cc427ec1 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/LogViewerController.cs @@ -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()) + { + + } + + 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 GetLogLevels() { - return _logViewer.GetLogLevels(); + return _logLevelLoader.GetLogLevelsFromSinks(); } [Obsolete("Please use GetLogLevels() instead. Scheduled for removal in V11.")]