Merge remote-tracking branch 'origin/v10/dev' into v10/feature/variant-permissions

# Conflicts:
#	src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
#	src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
#	src/Umbraco.Core/Models/ContentEditing/ContentVariationDisplay.cs
#	src/Umbraco.Core/Models/ContentEditing/UserGroupBasic.cs
#	src/Umbraco.Core/Models/ContentEditing/UserGroupSave.cs
#	src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
#	src/Umbraco.Core/Models/CultureImpact.cs
#	src/Umbraco.Core/Models/Mapping/ContentVariantMapper.cs
#	src/Umbraco.Core/Models/Mapping/UserMapDefinition.cs
#	src/Umbraco.Core/Models/Membership/IReadOnlyUserGroup.cs
#	src/Umbraco.Core/Models/Membership/IUserGroup.cs
#	src/Umbraco.Core/Models/Membership/ReadOnlyUserGroup.cs
#	src/Umbraco.Core/Models/Membership/UserGroup.cs
#	src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs
#	src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs
#	src/Umbraco.Core/Services/ContentService.cs
#	src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
#	src/Umbraco.Infrastructure/Persistence/Dtos/UserGroupDto.cs
#	src/Umbraco.Infrastructure/Persistence/Factories/UserFactory.cs
#	src/Umbraco.Infrastructure/Persistence/Factories/UserGroupFactory.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserGroupRepository.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
#	src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
#	src/Umbraco.Web.BackOffice/Controllers/ContentController.cs
#	src/Umbraco.Web.BackOffice/Filters/ContentSaveValidationAttribute.cs
#	src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs
#	src/Umbraco.Web.UI.Client/src/common/services/editor.service.js
This commit is contained in:
Zeegaan
2022-06-20 13:59:18 +02:00
3276 changed files with 224966 additions and 214173 deletions

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration;
@@ -26,9 +23,9 @@ using Umbraco.Cms.Web.BackOffice.Routing;
using Umbraco.Cms.Web.BackOffice.Security;
using Umbraco.Cms.Web.BackOffice.Trees;
using Umbraco.Cms.Web.Common.Attributes;
using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Cms.Web.Common.Models;
using Umbraco.Extensions;
using Language = Umbraco.Cms.Core.Models.ContentEditing.Language;
namespace Umbraco.Cms.Web.BackOffice.Controllers
{
@@ -40,21 +37,23 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
private readonly LinkGenerator _linkGenerator;
private readonly IRuntimeState _runtimeState;
private readonly UmbracoFeatures _features;
private GlobalSettings _globalSettings;
private GlobalSettings _globalSettings;
private readonly IUmbracoVersion _umbracoVersion;
private ContentSettings _contentSettings;
private ContentSettings _contentSettings;
private readonly TreeCollection _treeCollection;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IHostingEnvironment _hostingEnvironment;
private RuntimeSettings _runtimeSettings;
private SecuritySettings _securitySettings;
private RuntimeSettings _runtimeSettings;
private SecuritySettings _securitySettings;
private readonly IRuntimeMinifier _runtimeMinifier;
private readonly IBackOfficeExternalLoginProviders _externalLogins;
private readonly IImageUrlGenerator _imageUrlGenerator;
private readonly PreviewRoutes _previewRoutes;
private readonly IEmailSender _emailSender;
private MemberPasswordConfigurationSettings _memberPasswordConfigurationSettings;
private DataTypesSettings _dataTypesSettings;
[Obsolete("Use constructor that takes IOptionsMontior<DataTypeSettings>, scheduled for removal in V12")]
public BackOfficeServerVariables(
LinkGenerator linkGenerator,
IRuntimeState runtimeState,
@@ -73,6 +72,47 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
PreviewRoutes previewRoutes,
IEmailSender emailSender,
IOptionsMonitor<MemberPasswordConfigurationSettings> memberPasswordConfigurationSettings)
: this(
linkGenerator,
runtimeState,
features,
globalSettings,
umbracoVersion,
contentSettings,
httpContextAccessor,
treeCollection,
hostingEnvironment,
runtimeSettings,
securitySettings,
runtimeMinifier,
externalLogins,
imageUrlGenerator,
previewRoutes,
emailSender,
memberPasswordConfigurationSettings,
StaticServiceProvider.Instance.GetRequiredService<IOptionsMonitor<DataTypesSettings>>())
{
}
public BackOfficeServerVariables(
LinkGenerator linkGenerator,
IRuntimeState runtimeState,
UmbracoFeatures features,
IOptionsMonitor<GlobalSettings> globalSettings,
IUmbracoVersion umbracoVersion,
IOptionsMonitor<ContentSettings> contentSettings,
IHttpContextAccessor httpContextAccessor,
TreeCollection treeCollection,
IHostingEnvironment hostingEnvironment,
IOptionsMonitor<RuntimeSettings> runtimeSettings,
IOptionsMonitor<SecuritySettings> securitySettings,
IRuntimeMinifier runtimeMinifier,
IBackOfficeExternalLoginProviders externalLogins,
IImageUrlGenerator imageUrlGenerator,
PreviewRoutes previewRoutes,
IEmailSender emailSender,
IOptionsMonitor<MemberPasswordConfigurationSettings> memberPasswordConfigurationSettings,
IOptionsMonitor<DataTypesSettings> dataTypesSettings)
{
_linkGenerator = linkGenerator;
_runtimeState = runtimeState;
@@ -91,11 +131,13 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
_previewRoutes = previewRoutes;
_emailSender = emailSender;
_memberPasswordConfigurationSettings = memberPasswordConfigurationSettings.CurrentValue;
_dataTypesSettings = dataTypesSettings.CurrentValue;
globalSettings.OnChange(x => _globalSettings = x);
contentSettings.OnChange(x => _contentSettings = x);
runtimeSettings.OnChange(x => _runtimeSettings = x);
securitySettings.OnChange(x => _securitySettings = x);
dataTypesSettings.OnChange(x => _dataTypesSettings = x);
memberPasswordConfigurationSettings.OnChange(x => _memberPasswordConfigurationSettings = x);
}
@@ -115,7 +157,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
{"features", new [] {"disabledFeatures"}}
};
//now do the filtering...
var defaults = await GetServerVariablesAsync();
Dictionary<string, object> defaults = await GetServerVariablesAsync();
foreach (var key in defaults.Keys.ToArray())
{
if (keepOnlyKeys.ContainsKey(key) == false)
@@ -155,7 +197,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
/// <returns></returns>
internal async Task<Dictionary<string, object>> GetServerVariablesAsync()
{
var globalSettings = _globalSettings;
GlobalSettings globalSettings = _globalSettings;
var backOfficeControllerName = ControllerExtensions.GetControllerName<BackOfficeController>();
var defaultVals = new Dictionary<string, object>
{
@@ -186,7 +228,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"embedApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<RteEmbedController>(
controller => controller.GetEmbed("", 0, 0))
controller => controller.GetEmbed(string.Empty, 0, 0))
},
{
"userApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<UsersController>(
@@ -214,7 +256,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"imagesApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<ImagesController>(
controller => controller.GetBigThumbnail(""))
controller => controller.GetBigThumbnail(string.Empty))
},
{
"sectionApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<SectionController>(
@@ -322,7 +364,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"tagsDataBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<TagsDataController>(
controller => controller.GetTags("", "", null))
controller => controller.GetTags(string.Empty, string.Empty, null))
},
{
"examineMgmtBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<ExamineManagementController>(
@@ -338,7 +380,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"codeFileApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<CodeFileController>(
controller => controller.GetByPath("", ""))
controller => controller.GetByPath(string.Empty, string.Empty))
},
{
"publishedStatusBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<PublishedStatusController>(
@@ -354,7 +396,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
},
{
"helpApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<HelpController>(
controller => controller.GetContextHelpForPage("","",""))
controller => controller.GetContextHelpForPage(string.Empty,string.Empty,string.Empty))
},
{
"backOfficeAssetsApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<BackOfficeAssetsController>(
@@ -399,6 +441,10 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
"analyticsApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<AnalyticsController>(
controller => controller.GetConsentLevel())
},
{
"propertyTypeApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<PropertyTypeController>(
controller => controller.HasValues(string.Empty))
},
}
},
{
@@ -438,6 +484,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
{"minimumPasswordLength", _memberPasswordConfigurationSettings.RequiredLength},
{"minimumPasswordNonAlphaNum", _memberPasswordConfigurationSettings.GetMinNonAlphaNumericChars()},
{"sanitizeTinyMce", _globalSettings.SanitizeTinyMce},
{"dataTypesCanBeChanged", _dataTypesSettings.CanBeChanged.ToString()},
{"allowEditInvariantFromNonDefault", _securitySettings.AllowEditInvariantFromNonDefault},
}
},
@@ -511,19 +558,23 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
// do this instead
// inheriting from TreeControllerBase and marked with TreeAttribute
foreach (var tree in _treeCollection)
foreach (Tree tree in _treeCollection)
{
var treeType = tree.TreeControllerType;
Type treeType = tree.TreeControllerType;
// exclude anything marked with CoreTreeAttribute
var coreTree = treeType.GetCustomAttribute<CoreTreeAttribute>(false);
CoreTreeAttribute? coreTree = treeType.GetCustomAttribute<CoreTreeAttribute>(false);
if (coreTree != null)
{
continue;
}
// exclude anything not marked with PluginControllerAttribute
var pluginController = treeType.GetCustomAttribute<PluginControllerAttribute>(false);
PluginControllerAttribute? pluginController = treeType.GetCustomAttribute<PluginControllerAttribute>(false);
if (pluginController == null)
{
continue;
}
yield return new PluginTree { Alias = tree.TreeAlias, PackageFolder = pluginController.AreaName };
}