Merge remote-tracking branch 'origin/netcore/dev' into netcore/feature/domainservice-events

This commit is contained in:
Bjarke Berg
2021-04-07 12:43:43 +02:00
19 changed files with 116 additions and 93 deletions

View File

@@ -16,16 +16,6 @@ namespace Umbraco.Cms.Core.Composing
{
private readonly Assembly _entryPointAssembly;
private readonly ILoggerFactory _loggerFactory;
private static readonly string[] UmbracoCoreAssemblyNames = new[]
{
"Umbraco.Core",
"Umbraco.Infrastructure",
"Umbraco.PublishedCache.NuCache",
"Umbraco.Examine.Lucene",
"Umbraco.Web.Common",
"Umbraco.Web.BackOffice",
"Umbraco.Web.Website",
};
public DefaultUmbracoAssemblyProvider(Assembly entryPointAssembly, ILoggerFactory loggerFactory)
{
@@ -43,7 +33,7 @@ namespace Umbraco.Cms.Core.Composing
{
get
{
var finder = new FindAssembliesWithReferencesTo(new[] { _entryPointAssembly }, UmbracoCoreAssemblyNames, true, _loggerFactory);
var finder = new FindAssembliesWithReferencesTo(new[] { _entryPointAssembly }, Constants.Composing.UmbracoCoreAssemblyNames, true, _loggerFactory);
return finder.Find();
}
}

View File

@@ -82,9 +82,8 @@ namespace Umbraco.Cms.Core.Composing
assemblyName.FullName.StartsWith(f, StringComparison.InvariantCultureIgnoreCase)))
continue;
// don't include this item if it's Umbraco
// TODO: We should maybe pass an explicit list of these names in?
if (assemblyName.FullName.StartsWith("Umbraco.") || assemblyName.Name.EndsWith(".Views"))
// don't include this item if it's Umbraco Core
if (Constants.Composing.UmbracoCoreAssemblyNames.Any(x=>assemblyName.FullName.StartsWith(x) || assemblyName.Name.EndsWith(".Views")))
continue;
var assembly = Assembly.Load(assemblyName);

View File

@@ -9,6 +9,17 @@
/// Defines constants for composition.
/// </summary>
public static class Composing
{ }
{
public static readonly string[] UmbracoCoreAssemblyNames = new[]
{
"Umbraco.Core",
"Umbraco.Infrastructure",
"Umbraco.PublishedCache.NuCache",
"Umbraco.Examine.Lucene",
"Umbraco.Web.Common",
"Umbraco.Web.BackOffice",
"Umbraco.Web.Website",
};
}
}
}

View File

@@ -1,4 +1,5 @@
using Umbraco.Cms.Core.Composing;
using System;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Cms.Core.Dashboards
{
@@ -7,21 +8,10 @@ namespace Umbraco.Cms.Core.Dashboards
{
public string Alias => "contentIntro";
public string[] Sections => new [] { "content" };
public string[] Sections => new[] { "content" };
public string View => "views/dashboard/default/startupdashboardintro.html";
public IAccessRule[] AccessRules
{
get
{
var rules = new IAccessRule[]
{
new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias},
new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias}
};
return rules;
}
}
public IAccessRule[] AccessRules { get; } = Array.Empty<IAccessRule>();
}
}

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
@@ -46,6 +46,17 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
<!-- Making internals visible to Umbraco Forms -->
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Core</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Core.Providers</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Web</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>

View File

@@ -202,8 +202,8 @@ namespace Umbraco.Cms.Core.PropertyEditors
_richTextPropertyValueEditor.GetReferences(x.Value)))
yield return umbracoEntityReference;
foreach (var umbracoEntityReference in mediaValues.Where(x=>x.Value.HasValues).SelectMany(x =>
_mediaPickerPropertyValueEditor.GetReferences(x.Value["udi"])))
foreach (var umbracoEntityReference in mediaValues.Where(x=>x.Value.HasValues)
.SelectMany(x => _mediaPickerPropertyValueEditor.GetReferences(x.Value["udi"])))
yield return umbracoEntityReference;
}
}

View File

@@ -101,6 +101,17 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
<!-- Making internals visible to Umbraco Forms -->
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Core</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Core.Providers</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Web</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>

View File

@@ -71,8 +71,9 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
var allowedSections = string.Join(",", user.AllowedSections);
var language = user.Language;
var version = _umbracoVersion.SemanticVersion.ToSemanticString();
var isAdmin = user.IsAdmin();
var url = string.Format(baseUrl + "{0}?section={0}&allowed={1}&lang={2}&version={3}", section, allowedSections, language, version);
var url = string.Format(baseUrl + "{0}?section={0}&allowed={1}&lang={2}&version={3}&admin={4}", section, allowedSections, language, version, isAdmin);
var key = "umbraco-dynamic-dashboard-" + language + allowedSections.Replace(",", "-") + section;
var content = _appCaches.RuntimeCache.GetCacheItem<JObject>(key);

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
@@ -31,6 +31,11 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.Integration</_Parameter1>
</AssemblyAttribute>
<!-- Making internals visible to Umbraco Forms -->
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Web</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>

View File

@@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Web.Caching;
using SixLabors.ImageSharp.Web.Commands;
@@ -12,6 +11,7 @@ using SixLabors.ImageSharp.Web.DependencyInjection;
using SixLabors.ImageSharp.Web.Processors;
using SixLabors.ImageSharp.Web.Providers;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models.Identity;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Web.Common.Security;
@@ -69,8 +69,8 @@ namespace Umbraco.Extensions
.AddMemberManager<IMemberManager, MemberManager>()
.AddUserStore<MemberUserStore>()
.AddRoleStore<MemberRoleStore>()
.AddRoleValidator<RoleValidator<IdentityRole>>()
.AddRoleManager<RoleManager<IdentityRole>>();
.AddRoleValidator<RoleValidator<UmbracoIdentityRole>>()
.AddRoleManager<RoleManager<UmbracoIdentityRole>>();
private static MemberIdentityBuilder BuildMembersIdentity(this IServiceCollection services)
{
@@ -78,7 +78,7 @@ namespace Umbraco.Extensions
services.TryAddScoped<IUserValidator<MemberIdentityUser>, UserValidator<MemberIdentityUser>>();
services.TryAddScoped<IPasswordValidator<MemberIdentityUser>, PasswordValidator<MemberIdentityUser>>();
services.TryAddScoped<IPasswordHasher<MemberIdentityUser>, PasswordHasher<MemberIdentityUser>>();
return new MemberIdentityBuilder(typeof(IdentityRole), services);
return new MemberIdentityBuilder(typeof(UmbracoIdentityRole), services);
}
private static void RemoveIntParamenterIfValueGreatherThen(IDictionary<string, string> commands, string parameter, int maxValue)

View File

@@ -40,6 +40,11 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.UnitTests</_Parameter1>
</AssemblyAttribute>
<!-- Making internals visible to Umbraco Forms -->
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Web</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>

View File

@@ -29,10 +29,6 @@
var defaultFocusedElement = getAutoFocusElement(focusableElements);
var firstFocusableElement = focusableElements[0];
var lastFocusableElement = focusableElements[focusableElements.length -1];
// We need to add the tabbing-active class in order to highlight the focused button since the default style is
// outline: none; set in the stylesheet specifically
bodyElement.classList.add('tabbing-active');
// If there is no default focused element put focus on the first focusable element in the nodelist
if(defaultFocusedElement === null ){

View File

@@ -572,13 +572,15 @@
* Method for opening an item in a list view for editing.
*
* @param {Object} item The item to edit
* @param {Object} scope The scope with options
*/
function editItem(item, scope) {
if (!item.editPath) {
return;
}
if (scope.options.useInfiniteEditor)
if (scope && scope.options && scope.options.useInfiniteEditor)
{
var editorModel = {
id: item.id,

View File

@@ -15,6 +15,7 @@
right: 0;
border-radius: 3px;
box-shadow: 0 0 2px 0px @ui-outline, inset 0 0 2px 2px @ui-outline;
pointer-events: none;
}
}

View File

@@ -308,7 +308,14 @@ select[size] {
input[type="file"],
input[type="radio"],
input[type="checkbox"] {
.umb-outline();
&:focus {
border-color: @inputBorderFocus;
outline: 0;
.tabbing-active & {
outline: 2px solid @ui-outline;
}
}
}

View File

@@ -1,8 +1,8 @@
(function () {
"use strict";
function UserPickerController($scope, usersResource, localizationService, eventsService) {
function UserPickerController($scope, entityResource, localizationService, eventsService) {
var vm = this;
vm.users = [];
@@ -102,17 +102,9 @@
vm.loading = true;
// Get users
usersResource.getPagedResults(vm.usersOptions).then(function (users) {
vm.users = users.items;
vm.usersOptions.pageNumber = users.pageNumber;
vm.usersOptions.pageSize = users.pageSize;
vm.usersOptions.totalItems = users.totalItems;
vm.usersOptions.totalPages = users.totalPages;
entityResource.getAll("User").then(function (data) {
vm.users = data;
preSelect($scope.model.selection, vm.users);
vm.loading = false;
});
}

View File

@@ -1,9 +1,9 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Grid.MediaController",
function ($scope, userService, editorService, localizationService) {
$scope.thumbnailUrl = getThumbnailUrl();
function ($scope, userService, editorService, localizationService) {
$scope.thumbnailUrl = getThumbnailUrl();
if (!$scope.model.config.startNodeId) {
if ($scope.model.config.ignoreUserStartNodes === true) {
$scope.model.config.startNodeId = -1;
@@ -29,16 +29,16 @@ angular.module("umbraco")
onlyImages: true,
dataTypeKey: $scope.model.dataTypeKey,
submit: model => {
updateControlValue(model.selection[0]);
updateControlValue(model.selection[0]);
editorService.close();
},
close: () => editorService.close()
close: () => editorService.close()
};
editorService.mediaPicker(mediaPicker);
};
$scope.editImage = function() {
$scope.editImage = function() {
const mediaCropDetailsConfig = {
size: 'small',
@@ -47,17 +47,17 @@ angular.module("umbraco")
updateControlValue(model.target);
editorService.close();
},
close: () => editorService.close()
close: () => editorService.close()
};
localizationService.localize('defaultdialogs_editSelectedMedia').then(value => {
mediaCropDetailsConfig.title = value;
editorService.mediaCropDetails(mediaCropDetailsConfig);
});
});
}
/**
*
*
*/
function getThumbnailUrl() {
@@ -94,19 +94,15 @@ angular.module("umbraco")
return url;
}
return null;
}
/**
*
* @param {object} selectedImage
*
* @param {object} selectedImage
*/
function updateControlValue(selectedImage) {
const doGetThumbnail = $scope.control.value.focalPoint !== selectedImage.focalPoint
|| $scope.control.value.image !== selectedImage.image;
// we could apply selectedImage directly to $scope.control.value,
// but this allows excluding fields in future if needed
$scope.control.value = {
@@ -118,10 +114,6 @@ angular.module("umbraco")
caption: selectedImage.caption,
altText: selectedImage.altText
};
if (doGetThumbnail) {
$scope.thumbnailUrl = getThumbnailUrl();
}
}
$scope.thumbnailUrl = getThumbnailUrl();
}
});

View File

@@ -1,4 +1,4 @@
function userPickerController($scope, usersResource , iconHelper, editorService, overlayService){
function userPickerController($scope, iconHelper, editorService, overlayService, entityResource) {
function trim(str, chr) {
var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^' + chr + '+|' + chr + '+$', 'g');
@@ -92,17 +92,22 @@ function userPickerController($scope, usersResource , iconHelper, editorService,
unsubscribe();
});
//load user data
var modelIds = $scope.model.value ? $scope.model.value.split(',') : [];
// entityResource.getByIds doesn't support "User" and we would like to show avatars in umb-user-preview as well.
usersResource.getUsers(modelIds).then(function (data) {
_.each(data, function (item, i) {
// set default icon if it's missing
item.icon = item.icon ? iconHelper.convertFromLegacyIcon(item.icon) : "icon-user";
$scope.renderModel.push({ name: item.name, id: item.id, udi: item.udi, icon: item.icon, avatars: item.avatars });
});
});
//load user data - split to an array of ints (map)
const modelIds = $scope.model.value ? $scope.model.value.split(',').map(x => +x) : [];
if(modelIds.length !== 0) {
entityResource.getAll("User").then(function (users) {
const filteredUsers = users.filter(user => modelIds.indexOf(user.id) !== -1);
filteredUsers.forEach(item => {
$scope.renderModel.push({
name: item.name,
id: item.id,
udi: item.udi,
icon: item.icon = item.icon ? iconHelper.convertFromLegacyIcon(item.icon) : "icon-user",
avatars: item.avatars
});
});
});
}
}

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
@@ -34,5 +34,10 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.Integration</_Parameter1>
</AssemblyAttribute>
<!-- Making internals visible to Umbraco Forms -->
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Forms.Web</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>