From ab16a408a8b852287952f8d655243b665988f1b8 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 17 Mar 2021 14:04:48 +0100 Subject: [PATCH 01/19] Adds a config for configuring the access rules on the content dashboard - by default it granted for all user groups --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 + .../config/content.dashboard.access.config.js | 22 ++++++++++++++++ .../Dashboards/ContentDashboard.cs | 26 ++++++++++++++----- 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 src/Umbraco.Web.UI/config/content.dashboard.access.config.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index eb6649a7c4..7fb27deb7e 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -148,6 +148,7 @@ True Settings.settings + diff --git a/src/Umbraco.Web.UI/config/content.dashboard.access.config.js b/src/Umbraco.Web.UI/config/content.dashboard.access.config.js new file mode 100644 index 0000000000..93c727d85a --- /dev/null +++ b/src/Umbraco.Web.UI/config/content.dashboard.access.config.js @@ -0,0 +1,22 @@ +[ + { + "Type": "grant", + "Value": "admin" + }, + { + "Type": "grant", + "Value": "editor" + }, + { + "Type": "grant", + "Value": "sensitiveData" + }, + { + "Type": "grant", + "Value": "translator" + }, + { + "Type": "grant", + "Value": "writer" + } +] diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 0cd96f738c..3dbc0cb693 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -1,6 +1,9 @@ -using Umbraco.Core; +using System.IO; +using Newtonsoft.Json; +using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; +using Umbraco.Core.IO; namespace Umbraco.Web.Dashboards { @@ -9,7 +12,7 @@ namespace Umbraco.Web.Dashboards { public string Alias => "contentIntro"; - public string[] Sections => new [] { "content" }; + public string[] Sections => new[] { "content" }; public string View => "views/dashboard/default/startupdashboardintro.html"; @@ -17,11 +20,22 @@ namespace Umbraco.Web.Dashboards { get { - var rules = new IAccessRule[] + IAccessRule[] rules; + var dashboardConfig = Path.Combine(IOHelper.MapPath(SystemDirectories.Config), "content.dashboard.access.config.js"); + + if (File.Exists(dashboardConfig)) { - new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias}, - new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} - }; + var rawJson = File.ReadAllText(dashboardConfig); + rules = JsonConvert.DeserializeObject(rawJson); + } + else + { + rules = new IAccessRule[] + { + new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias}, + new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} + }; + } return rules; } } From 3393ac8d0369c097e306d419201fb299c939a560 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 17 Mar 2021 14:05:47 +0100 Subject: [PATCH 02/19] Adds additional params indicating whether user is admin --- src/Umbraco.Web/Editors/DashboardController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index eef0b5df93..c7ce4e1220 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -17,6 +17,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Core.Dashboards; +using Umbraco.Core.Models; using Umbraco.Web.Services; namespace Umbraco.Web.Editors @@ -52,8 +53,9 @@ namespace Umbraco.Web.Editors 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(key); From e7a1db5604d4dd750a7093cfbdfa0b223ad026f9 Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Wed, 17 Mar 2021 21:54:38 +1000 Subject: [PATCH 03/19] Add images in grid - fixes 9982 (#9987) Co-authored-by: Sebastiaan Janssen (cherry picked from commit e2019777fbfc1f9221d040cb9f0b82c57f8552b9) --- .../grid/editors/media.controller.js | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js index 716ca405c1..94ea4b8604 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js @@ -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(); + } }); From 548435dcc3f1f23df7f83dcc77fdfc87963ea355 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 17 Mar 2021 17:40:47 +0100 Subject: [PATCH 04/19] Bump version to 8.12.2 --- src/SolutionInfo.cs | 4 ++-- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index e92eefdf52..4162f47da6 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -18,5 +18,5 @@ using System.Resources; [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically -[assembly: AssemblyFileVersion("8.12.1")] -[assembly: AssemblyInformationalVersion("8.12.1")] +[assembly: AssemblyFileVersion("8.12.2")] +[assembly: AssemblyInformationalVersion("8.12.2")] diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index eb6649a7c4..2ad23e1b73 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -347,9 +347,9 @@ False True - 8121 + 8122 / - http://localhost:8121 + http://localhost:8122 False False From e17bf386a48df8fffa9e57f5360675e661f8eaac Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 18 Mar 2021 09:28:58 +0100 Subject: [PATCH 05/19] Merge pull request #9994 from umbraco/v8/bugfix/9993 Fixes #9993 - Cannot save empty image in Grid (cherry picked from commit 0ecc933921f2dea9a2a16d6f395b44a039663ec6) --- src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs index 862837381a..f9eacd9e73 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs @@ -202,8 +202,8 @@ namespace Umbraco.Web.PropertyEditors _richTextPropertyValueEditor.GetReferences(x.Value))) yield return umbracoEntityReference; - foreach (var umbracoEntityReference in mediaValues.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; } } From 73439d4cbab197fa9292761c04c50b08db8663ae Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 18 Mar 2021 13:01:46 +0100 Subject: [PATCH 06/19] Fixes #9983 - Getting kicked, if document type has a Umbraco.UserPicker property (#10002) * Fixes #9983 Temporary fix for this issue. using the entityservice like before. * Needed to remove the call to usersResource here as well for displaying the picked items * Don't need usersResource for now (cherry picked from commit 45de0a101eaa2b8f16e21a765f32928c7cb968be) --- .../userpicker/userpicker.controller.js | 16 +++------- .../userpicker/userpicker.controller.js | 29 +++++++++++-------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/userpicker/userpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/userpicker/userpicker.controller.js index a7021b2867..33d526c3cf 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/userpicker/userpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/userpicker/userpicker.controller.js @@ -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; }); } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/userpicker/userpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/userpicker/userpicker.controller.js index f2055fea3a..217a9c8421 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/userpicker/userpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/userpicker/userpicker.controller.js @@ -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 + }); + }); + }); + } } From eabfa7f414fcf89efbe34cf49b7e8563c0d2de3c Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 24 Mar 2021 15:28:06 +0100 Subject: [PATCH 07/19] Getting rid of the config file and implementing an appSetting instead --- .../Configuration/GlobalSettings.cs | 22 +++++++++++++++++++ .../Configuration/IGlobalSettings.cs | 9 ++++++++ src/Umbraco.Core/Constants-AppSettings.cs | 5 +++++ src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../config/content.dashboard.access.config.js | 22 ------------------- src/Umbraco.Web.UI/web.Template.config | 1 + 6 files changed, 37 insertions(+), 23 deletions(-) delete mode 100644 src/Umbraco.Web.UI/config/content.dashboard.access.config.js diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index ba5baf9e87..0765a35a29 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -395,6 +395,28 @@ namespace Umbraco.Core.Configuration } } + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + public bool AllowContentDashboardAccessToAllUsers + { + get + { + try + { + return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers]); + } + catch + { + return false; + } + } + } + /// /// An int value representing the time in milliseconds to lock the database for a write operation diff --git a/src/Umbraco.Core/Configuration/IGlobalSettings.cs b/src/Umbraco.Core/Configuration/IGlobalSettings.cs index 483829f85f..6016de2917 100644 --- a/src/Umbraco.Core/Configuration/IGlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/IGlobalSettings.cs @@ -57,6 +57,15 @@ /// bool UseHttps { get; } + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + bool AllowContentDashboardAccessToAllUsers { get; } + /// /// Returns a string value to determine if umbraco should skip version-checking. /// diff --git a/src/Umbraco.Core/Constants-AppSettings.cs b/src/Umbraco.Core/Constants-AppSettings.cs index f04f0e1f5f..1f096ab9f9 100644 --- a/src/Umbraco.Core/Constants-AppSettings.cs +++ b/src/Umbraco.Core/Constants-AppSettings.cs @@ -110,6 +110,11 @@ namespace Umbraco.Core /// public const string UseHttps = "Umbraco.Core.UseHttps"; + /// + /// A true/false value indicating whether the content dashboard should be visible for all user groups. + /// + public const string AllowContentDashboardAccessToAllUsers = "Umbraco.Core.AllowContentDashboardAccessToAllUsers"; + /// /// TODO: FILL ME IN /// diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 7fb27deb7e..eb6649a7c4 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -148,7 +148,6 @@ True Settings.settings - diff --git a/src/Umbraco.Web.UI/config/content.dashboard.access.config.js b/src/Umbraco.Web.UI/config/content.dashboard.access.config.js deleted file mode 100644 index 93c727d85a..0000000000 --- a/src/Umbraco.Web.UI/config/content.dashboard.access.config.js +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "Type": "grant", - "Value": "admin" - }, - { - "Type": "grant", - "Value": "editor" - }, - { - "Type": "grant", - "Value": "sensitiveData" - }, - { - "Type": "grant", - "Value": "translator" - }, - { - "Type": "grant", - "Value": "writer" - } -] diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index 03f462fb9e..ae141e5408 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -37,6 +37,7 @@ + From 6e54c6fefde685a0d10fe9a2fdf5c82177b8c0b0 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 24 Mar 2021 15:34:05 +0100 Subject: [PATCH 08/19] Implementation for IContentDashboardSettings --- src/Umbraco.Core/ConfigsExtensions.cs | 6 +++ .../Dashboards/ContentDashboardSettings.cs | 43 +++++++++++++++++++ .../Dashboards/IContentDashboardSettings.cs | 13 ++++++ src/Umbraco.Core/Umbraco.Core.csproj | 2 + .../Dashboards/ContentDashboard.cs | 17 ++++---- 5 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs create mode 100644 src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs index d1672c6c7f..17dc63943a 100644 --- a/src/Umbraco.Core/ConfigsExtensions.cs +++ b/src/Umbraco.Core/ConfigsExtensions.cs @@ -5,9 +5,11 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Grid; using Umbraco.Core.Configuration.HealthChecks; using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Core.Dashboards; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; +using Umbraco.Core.Services; namespace Umbraco.Core { @@ -48,6 +50,10 @@ namespace Umbraco.Core configDir, factory.GetInstance(), factory.GetInstance().Debug)); + + configs.Add(factory => + new ContentDashboardSettings(factory.GetInstance(), + factory.GetInstance())); } } } diff --git a/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs new file mode 100644 index 0000000000..3db808fe02 --- /dev/null +++ b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core.Configuration; +using Umbraco.Core.Services; + +namespace Umbraco.Core.Dashboards +{ + public class ContentDashboardSettings: IContentDashboardSettings + { + private readonly IGlobalSettings _globalSettings; + private readonly IUserService _userService; + + public ContentDashboardSettings(IGlobalSettings globalSettings, IUserService userService) + { + _globalSettings = globalSettings; + _userService = userService; + } + + public IAccessRule[] GetAccessRulesFromConfig() + { + var rules = new List(); + + if (_globalSettings.AllowContentDashboardAccessToAllUsers) + { + var allUserGroups = _userService.GetAllUserGroups(); + + foreach (var userGroup in allUserGroups) + { + rules.Add(new AccessRule + { + Type = AccessRuleType.Grant, + Value = userGroup.Alias + }); + } + } + + return rules.ToArray(); + } + } +} diff --git a/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs new file mode 100644 index 0000000000..9b5ea7d7dd --- /dev/null +++ b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Core.Dashboards +{ + public interface IContentDashboardSettings + { + IAccessRule[] GetAccessRulesFromConfig(); + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 832b8a5801..63c7ac178d 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -131,6 +131,8 @@ + + diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 3dbc0cb693..4b17bcf7ff 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -10,6 +10,7 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class ContentDashboard : IDashboard { + private readonly IContentDashboardSettings _dashboardSettings; public string Alias => "contentIntro"; public string[] Sections => new[] { "content" }; @@ -20,15 +21,9 @@ namespace Umbraco.Web.Dashboards { get { - IAccessRule[] rules; - var dashboardConfig = Path.Combine(IOHelper.MapPath(SystemDirectories.Config), "content.dashboard.access.config.js"); + var rules = _dashboardSettings.GetAccessRulesFromConfig(); - if (File.Exists(dashboardConfig)) - { - var rawJson = File.ReadAllText(dashboardConfig); - rules = JsonConvert.DeserializeObject(rawJson); - } - else + if (rules.Length == 0) { rules = new IAccessRule[] { @@ -36,8 +31,14 @@ namespace Umbraco.Web.Dashboards new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} }; } + return rules; } } + + public ContentDashboard(IContentDashboardSettings dashboardSettings) + { + _dashboardSettings = dashboardSettings; + } } } From 61f486ebeaac426a6fc304d0bebbab9cc35d15e6 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 24 Mar 2021 15:36:29 +0100 Subject: [PATCH 09/19] Cleanup --- src/Umbraco.Core/ConfigsExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs index 17dc63943a..92d03adadb 100644 --- a/src/Umbraco.Core/ConfigsExtensions.cs +++ b/src/Umbraco.Core/ConfigsExtensions.cs @@ -1,6 +1,5 @@ using System.IO; using Umbraco.Core.Cache; -using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Grid; using Umbraco.Core.Configuration.HealthChecks; From 56d5704167e940c540ae67864cdb5263b9b535f3 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 24 Mar 2021 16:15:21 +0100 Subject: [PATCH 10/19] bool.Try --- src/Umbraco.Core/Configuration/GlobalSettings.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 0765a35a29..a451018169 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -406,14 +406,8 @@ namespace Umbraco.Core.Configuration { get { - try - { - return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers]); - } - catch - { - return false; - } + bool.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers], out var value); + return value; } } From f68d4d6968358c0c7aefe75aa2324cd591511005 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Thu, 25 Mar 2021 11:11:41 +0100 Subject: [PATCH 11/19] Taking AllowContentDashboardAccessToAllUsers prop from GlobalSettings to ContentDashboardSettings and saving AccessRulesFromConfig into a backing field --- src/Umbraco.Core/ConfigsExtensions.cs | 5 +-- .../Configuration/GlobalSettings.cs | 17 -------- .../Configuration/IGlobalSettings.cs | 9 ---- .../Dashboards/ContentDashboardSettings.cs | 43 ++++++------------- .../Dashboards/IContentDashboardSettings.cs | 17 ++++---- .../Dashboards/ContentDashboard.cs | 42 +++++++++++++++--- 6 files changed, 59 insertions(+), 74 deletions(-) diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs index 92d03adadb..10594fc970 100644 --- a/src/Umbraco.Core/ConfigsExtensions.cs +++ b/src/Umbraco.Core/ConfigsExtensions.cs @@ -8,7 +8,6 @@ using Umbraco.Core.Dashboards; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; -using Umbraco.Core.Services; namespace Umbraco.Core { @@ -50,9 +49,7 @@ namespace Umbraco.Core factory.GetInstance(), factory.GetInstance().Debug)); - configs.Add(factory => - new ContentDashboardSettings(factory.GetInstance(), - factory.GetInstance())); + configs.Add(() => new ContentDashboardSettings()); } } } diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index a451018169..c844abe75e 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -395,23 +395,6 @@ namespace Umbraco.Core.Configuration } } - /// - /// Gets a value indicating whether the content dashboard should be available to all users. - /// - /// - /// true if the dashboard is visible for all user groups; otherwise, false - /// and the default access rules for that dashboard will be in use. - /// - public bool AllowContentDashboardAccessToAllUsers - { - get - { - bool.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers], out var value); - return value; - } - } - - /// /// An int value representing the time in milliseconds to lock the database for a write operation /// diff --git a/src/Umbraco.Core/Configuration/IGlobalSettings.cs b/src/Umbraco.Core/Configuration/IGlobalSettings.cs index 6016de2917..483829f85f 100644 --- a/src/Umbraco.Core/Configuration/IGlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/IGlobalSettings.cs @@ -57,15 +57,6 @@ /// bool UseHttps { get; } - /// - /// Gets a value indicating whether the content dashboard should be available to all users. - /// - /// - /// true if the dashboard is visible for all user groups; otherwise, false - /// and the default access rules for that dashboard will be in use. - /// - bool AllowContentDashboardAccessToAllUsers { get; } - /// /// Returns a string value to determine if umbraco should skip version-checking. /// diff --git a/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs index 3db808fe02..f8fb5c7b06 100644 --- a/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs +++ b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs @@ -1,43 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Umbraco.Core.Configuration; -using Umbraco.Core.Services; +using System.Configuration; namespace Umbraco.Core.Dashboards { public class ContentDashboardSettings: IContentDashboardSettings { - private readonly IGlobalSettings _globalSettings; - private readonly IUserService _userService; - public ContentDashboardSettings(IGlobalSettings globalSettings, IUserService userService) + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + public bool AllowContentDashboardAccessToAllUsers { - _globalSettings = globalSettings; - _userService = userService; - } - - public IAccessRule[] GetAccessRulesFromConfig() - { - var rules = new List(); - - if (_globalSettings.AllowContentDashboardAccessToAllUsers) + get { - var allUserGroups = _userService.GetAllUserGroups(); - - foreach (var userGroup in allUserGroups) - { - rules.Add(new AccessRule - { - Type = AccessRuleType.Grant, - Value = userGroup.Alias - }); - } + bool.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers], out var value); + return value; } - - return rules.ToArray(); } } } diff --git a/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs index 9b5ea7d7dd..862a28b90e 100644 --- a/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs +++ b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs @@ -1,13 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Umbraco.Core.Dashboards +namespace Umbraco.Core.Dashboards { public interface IContentDashboardSettings { - IAccessRule[] GetAccessRulesFromConfig(); + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + bool AllowContentDashboardAccessToAllUsers { get; } } } diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 4b17bcf7ff..260eb8baf9 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -1,9 +1,8 @@ -using System.IO; -using Newtonsoft.Json; +using System.Collections.Generic; using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; -using Umbraco.Core.IO; +using Umbraco.Core.Services; namespace Umbraco.Web.Dashboards { @@ -11,6 +10,9 @@ namespace Umbraco.Web.Dashboards public class ContentDashboard : IDashboard { private readonly IContentDashboardSettings _dashboardSettings; + private readonly IUserService _userService; + private IAccessRule[] _accessRulesFromConfig; + public string Alias => "contentIntro"; public string[] Sections => new[] { "content" }; @@ -21,7 +23,7 @@ namespace Umbraco.Web.Dashboards { get { - var rules = _dashboardSettings.GetAccessRulesFromConfig(); + var rules = AccessRulesFromConfig; if (rules.Length == 0) { @@ -36,9 +38,39 @@ namespace Umbraco.Web.Dashboards } } - public ContentDashboard(IContentDashboardSettings dashboardSettings) + private IAccessRule[] AccessRulesFromConfig + { + get + { + if (_accessRulesFromConfig is null) + { + var rules = new List(); + + if (_dashboardSettings.AllowContentDashboardAccessToAllUsers) + { + var allUserGroups = _userService.GetAllUserGroups(); + + foreach (var userGroup in allUserGroups) + { + rules.Add(new AccessRule + { + Type = AccessRuleType.Grant, + Value = userGroup.Alias + }); + } + } + + _accessRulesFromConfig = rules.ToArray(); + } + + return _accessRulesFromConfig; + } + } + + public ContentDashboard(IContentDashboardSettings dashboardSettings, IUserService userService) { _dashboardSettings = dashboardSettings; + _userService = userService; } } } From c881fa9e7d08c11954e18489827f70cdafceb947 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 30 Mar 2021 17:03:56 +0200 Subject: [PATCH 12/19] Fixes tabbing-mode remains active after closing modal #9790 (#10074) --- .../components/forms/umbfocuslock.directive.js | 4 ---- .../src/less/application/umb-outline.less | 1 + src/Umbraco.Web.UI.Client/src/less/forms.less | 9 ++++++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js index 569f49b88a..f7cd32217e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js @@ -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 ){ diff --git a/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less b/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less index 939366d5ac..1f1c2c0e72 100644 --- a/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less +++ b/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less @@ -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; } } diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less index 90b2dbe37e..17c62037cc 100644 --- a/src/Umbraco.Web.UI.Client/src/less/forms.less +++ b/src/Umbraco.Web.UI.Client/src/less/forms.less @@ -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; + } + } } From 15923aafc7723f1823a045b7e635cfb4cffbd786 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 30 Mar 2021 17:03:56 +0200 Subject: [PATCH 13/19] Fixes tabbing-mode remains active after closing modal #9790 (#10074) (cherry picked from commit c881fa9e7d08c11954e18489827f70cdafceb947) --- .../components/forms/umbfocuslock.directive.js | 4 ---- .../src/less/application/umb-outline.less | 1 + src/Umbraco.Web.UI.Client/src/less/forms.less | 9 ++++++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js index 569f49b88a..f7cd32217e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbfocuslock.directive.js @@ -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 ){ diff --git a/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less b/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less index 939366d5ac..1f1c2c0e72 100644 --- a/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less +++ b/src/Umbraco.Web.UI.Client/src/less/application/umb-outline.less @@ -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; } } diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less index 90b2dbe37e..17c62037cc 100644 --- a/src/Umbraco.Web.UI.Client/src/less/forms.less +++ b/src/Umbraco.Web.UI.Client/src/less/forms.less @@ -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; + } + } } From 72e468428ad0c76ea4076d22693cc38f8a331eae Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Fri, 19 Mar 2021 16:57:40 +0100 Subject: [PATCH 14/19] Null check on scope and options to ensure backward compatibility (cherry picked from commit fe8cd239d2f4c528c1a8a3cf4c50e90bb43cacfc) --- .../src/common/services/listviewhelper.service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js index 14643dc9cd..f9ebba00ea 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js @@ -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, From 9381c2e915472cc21bd5d68f06348cdd67744e76 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 31 Mar 2021 19:45:48 +0200 Subject: [PATCH 15/19] Added internals visible to configuration for Umbraco Forms. --- src/Umbraco.Core/Umbraco.Core.csproj | 22 ++++++++++++++++++- .../Umbraco.Infrastructure.csproj | 20 +++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index ce524a09a1..36b9c4d171 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -46,6 +46,26 @@ <_Parameter1>DynamicProxyGenAssembly2 + + + + <_Parameter1>Umbraco.Forms.Core + + + <_Parameter1>Umbraco.Forms.Core.Providers + + + <_Parameter1>Umbraco.Forms.Web + + + <_Parameter1>Umbraco.Forms.Core.V9 + + + <_Parameter1>Umbraco.Forms.Core.Providers.V9 + + + <_Parameter1>Umbraco.Forms.Web.V9 + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index e5ee719a05..e870b02049 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -101,6 +101,26 @@ <_Parameter1>DynamicProxyGenAssembly2 + + + + <_Parameter1>Umbraco.Forms.Core + + + <_Parameter1>Umbraco.Forms.Core.Providers + + + <_Parameter1>Umbraco.Forms.Web + + + <_Parameter1>Umbraco.Forms.Core.V9 + + + <_Parameter1>Umbraco.Forms.Core.Providers.V9 + + + <_Parameter1>Umbraco.Forms.Web.V9 + From 1d9dbff72e05f8603ffc0ae0564515488728a77b Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 31 Mar 2021 19:49:54 +0200 Subject: [PATCH 16/19] Removed unnecessary V9 suffixes. --- src/Umbraco.Core/Umbraco.Core.csproj | 29 +++++++------------ .../Umbraco.Infrastructure.csproj | 11 +------ 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 36b9c4d171..cade1041ac 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -47,25 +47,16 @@ <_Parameter1>DynamicProxyGenAssembly2 - - - <_Parameter1>Umbraco.Forms.Core - - - <_Parameter1>Umbraco.Forms.Core.Providers - - - <_Parameter1>Umbraco.Forms.Web - - - <_Parameter1>Umbraco.Forms.Core.V9 - - - <_Parameter1>Umbraco.Forms.Core.Providers.V9 - - - <_Parameter1>Umbraco.Forms.Web.V9 - + + + <_Parameter1>Umbraco.Forms.Core + + + <_Parameter1>Umbraco.Forms.Core.Providers + + + <_Parameter1>Umbraco.Forms.Web + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index e870b02049..baa69dddb9 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -102,7 +102,7 @@ <_Parameter1>DynamicProxyGenAssembly2 - + <_Parameter1>Umbraco.Forms.Core @@ -112,15 +112,6 @@ <_Parameter1>Umbraco.Forms.Web - - <_Parameter1>Umbraco.Forms.Core.V9 - - - <_Parameter1>Umbraco.Forms.Core.Providers.V9 - - - <_Parameter1>Umbraco.Forms.Web.V9 - From aae7fc955f7241c89ddfadbb8adfb092f784d79e Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Fri, 2 Apr 2021 11:48:21 +0200 Subject: [PATCH 17/19] Made web layer internals visible to Umbraco Forms assemblies. --- src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj | 7 ++++++- src/Umbraco.Web.Common/Umbraco.Web.Common.csproj | 5 +++++ src/Umbraco.Web.Website/Umbraco.Web.Website.csproj | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj index d49eb6e4f5..967e2043f4 100644 --- a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj +++ b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -31,6 +31,11 @@ <_Parameter1>Umbraco.Tests.Integration + + + + <_Parameter1>Umbraco.Forms.Web + diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index bb2ecbc346..24f20f2f4a 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -40,6 +40,11 @@ <_Parameter1>Umbraco.Tests.UnitTests + + + + <_Parameter1>Umbraco.Forms.Web + diff --git a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj index a7c5e7a277..31a2ef25b2 100644 --- a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj +++ b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -34,5 +34,10 @@ <_Parameter1>Umbraco.Tests.Integration + + + + <_Parameter1>Umbraco.Forms.Web + From 32e1b8361f5ace781ab8146067d024dbebbf16c1 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 6 Apr 2021 08:23:07 +0200 Subject: [PATCH 18/19] Fix for members build issue --- .../DependencyInjection/ServiceCollectionExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.Common/DependencyInjection/ServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/DependencyInjection/ServiceCollectionExtensions.cs index 5182db4e20..49ed441932 100644 --- a/src/Umbraco.Web.Common/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/Umbraco.Web.Common/DependencyInjection/ServiceCollectionExtensions.cs @@ -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() .AddUserStore() .AddRoleStore() - .AddRoleValidator>() - .AddRoleManager>(); + .AddRoleValidator>() + .AddRoleManager>(); private static MemberIdentityBuilder BuildMembersIdentity(this IServiceCollection services) { @@ -78,7 +78,7 @@ namespace Umbraco.Extensions services.TryAddScoped, UserValidator>(); services.TryAddScoped, PasswordValidator>(); services.TryAddScoped, PasswordHasher>(); - return new MemberIdentityBuilder(typeof(IdentityRole), services); + return new MemberIdentityBuilder(typeof(UmbracoIdentityRole), services); } private static void RemoveIntParamenterIfValueGreatherThen(IDictionary commands, string parameter, int maxValue) From 18be3473331c064d311ee7808b733a898a9bfe68 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 6 Apr 2021 18:46:38 +0200 Subject: [PATCH 19/19] Fix todo by checking explicitly for Umbraco Core assembly names instead of "Umbraco.", to avoid special case forms, deploy etc. --- .../Composing/DefaultUmbracoAssemblyProvider.cs | 12 +----------- src/Umbraco.Core/Composing/ReferenceResolver.cs | 5 ++--- src/Umbraco.Core/Constants-Composing.cs | 13 ++++++++++++- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs index 516f26774a..60aa666034 100644 --- a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs +++ b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs @@ -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(); } } diff --git a/src/Umbraco.Core/Composing/ReferenceResolver.cs b/src/Umbraco.Core/Composing/ReferenceResolver.cs index 6ecd425ac1..fdc72a183b 100644 --- a/src/Umbraco.Core/Composing/ReferenceResolver.cs +++ b/src/Umbraco.Core/Composing/ReferenceResolver.cs @@ -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); diff --git a/src/Umbraco.Core/Constants-Composing.cs b/src/Umbraco.Core/Constants-Composing.cs index a92f71ee04..747a74b8d8 100644 --- a/src/Umbraco.Core/Constants-Composing.cs +++ b/src/Umbraco.Core/Constants-Composing.cs @@ -9,6 +9,17 @@ /// Defines constants for composition. /// 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", + }; + } } }