Merge pull request #8944 from umbraco/netcore/bugfix/8856-user_culture_not_used_everywhere

Netcore: Bugfix for user culture not used everywhere
This commit is contained in:
Mole
2020-09-23 09:58:30 +02:00
committed by GitHub
30 changed files with 34 additions and 27 deletions

View File

@@ -51,6 +51,7 @@
public const string BackOfficePathSegment = "BackOffice"; // The path segment prefix for all back office controllers
public const string BackOfficeArea = "UmbracoBackOffice"; // Used for area routes of non-api controllers
public const string BackOfficeApiArea = "UmbracoApi"; // Same name as v8 so all routing remains the same
public const string BackOfficeTreeArea = "UmbracoTrees"; // Same name as v8 so all routing remains the same
}
}
}

View File

@@ -11,6 +11,7 @@ using Umbraco.Core.Services;
using Umbraco.Tests.Common.Builders;
using Umbraco.Tests.Common.Builders.Extensions;
using Umbraco.Tests.Testing;
using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.Common.Formatters;
using Umbraco.Web.Editors;
using Umbraco.Web.Models.ContentEditing;

View File

@@ -22,6 +22,7 @@ using Umbraco.Web.Common.Builder;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Editors;
using Microsoft.Extensions.Hosting;
using Umbraco.Web.BackOffice.Controllers;
namespace Umbraco.Tests.Integration.TestServerTest
{

View File

@@ -39,7 +39,7 @@ using Umbraco.Web.Models.Mapping;
using Umbraco.Web.Security;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Editors
namespace Umbraco.Web.BackOffice.Controllers
{
/// <summary>
/// The API controller used for editing content

View File

@@ -4,7 +4,7 @@ using Umbraco.Core.Services;
using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.Common.Attributes;
namespace Umbraco.Web.Editors
namespace Umbraco.Web.BackOffice.Controllers
{
[PluginController("UmbracoApi")]
public class IconController : UmbracoAuthorizedApiController

View File

@@ -21,10 +21,11 @@ using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Editors;
using Umbraco.Web.Routing;
using Umbraco.Web.Security;
namespace Umbraco.Web.Editors
namespace Umbraco.Web.BackOffice.Controllers
{
/// <summary>
/// An API controller used for dealing with member types

View File

@@ -15,7 +15,7 @@ using Umbraco.Web.Security;
using Umbraco.Web.Services;
using Umbraco.Web.Trees;
namespace Umbraco.Web.Editors
namespace Umbraco.Web.BackOffice.Controllers
{
/// <summary>
/// The API controller used for using the list of sections

View File

@@ -30,7 +30,7 @@ namespace Umbraco.Web.Trees
/// Used to return tree root nodes
/// </summary>
[AngularJsonOnlyConfiguration]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
public class ApplicationTreeController : UmbracoAuthorizedApiController
{
private readonly ITreeService _treeService;

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Web.Trees
/// </remarks>
[UmbracoApplicationAuthorize(Constants.Applications.Content)]
[Tree(Constants.Applications.Settings, Constants.Trees.ContentBlueprints, SortOrder = 12, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class ContentBlueprintTreeController : TreeController
{

View File

@@ -36,7 +36,7 @@ namespace Umbraco.Web.Trees
Constants.Applications.Packages,
Constants.Applications.Members)]
[Tree(Constants.Applications.Content, Constants.Trees.Content)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
[SearchableTree("searchResultFormatter", "configureContentResult", 10)]
public class ContentTreeController : ContentTreeControllerBase, ISearchableTree

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.DocumentTypes, SortOrder = 0, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class ContentTypeTreeController : TreeController, ISearchableTree
{

View File

@@ -19,7 +19,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.DataTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.DataTypes, SortOrder = 3, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class DataTypeTreeController : TreeController, ISearchableTree
{

View File

@@ -20,7 +20,7 @@ namespace Umbraco.Web.Trees
// We are allowed to see the dictionary tree, if we are allowed to manage templates, such that se can use the
// dictionary items in templates, even when we dont have authorization to manage the dictionary items
)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
[Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, TreeGroup = Constants.Trees.Groups.Settings)]
public class DictionaryTreeController : TreeController

View File

@@ -11,7 +11,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Languages)]
[Tree(Constants.Applications.Settings, Constants.Trees.Languages, SortOrder = 11, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class LanguageTreeController : TreeController
{

View File

@@ -11,7 +11,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.LogViewer)]
[Tree(Constants.Applications.Settings, Constants.Trees.LogViewer, SortOrder= 9, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class LogViewerTreeController : TreeController
{

View File

@@ -13,7 +13,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Macros)]
[Tree(Constants.Applications.Settings, Constants.Trees.Macros, TreeTitle = "Macros", SortOrder = 4, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class MacrosTreeController : TreeController
{

View File

@@ -32,7 +32,7 @@ namespace Umbraco.Web.Trees
Constants.Applications.Packages,
Constants.Applications.Members)]
[Tree(Constants.Applications.Media, Constants.Trees.Media)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
[SearchableTree("searchResultFormatter", "configureMediaResult", 20)]
public class MediaTreeController : ContentTreeControllerBase, ISearchableTree, ITreeNodeController

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.MediaTypes, SortOrder = 1, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class MediaTypeTreeController : TreeController, ISearchableTree
{

View File

@@ -13,7 +13,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.MemberGroups)]
[Tree(Constants.Applications.Members, Constants.Trees.MemberGroups, SortOrder = 1)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class MemberGroupTreeController : MemberTypeAndGroupTreeControllerBase
{

View File

@@ -29,7 +29,7 @@ namespace Umbraco.Web.Trees
Constants.Applications.Media,
Constants.Applications.Members)]
[Tree(Constants.Applications.Members, Constants.Trees.Members, SortOrder = 0)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
[SearchableTree("searchResultFormatter", "configureMemberResult")]
public class MemberTreeController : TreeController, ISearchableTree, ITreeNodeController

View File

@@ -10,7 +10,7 @@ using Umbraco.Web.WebApi;
namespace Umbraco.Web.Trees
{
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public abstract class MemberTypeAndGroupTreeControllerBase : TreeController
{

View File

@@ -17,7 +17,7 @@ namespace Umbraco.Web.Trees
[CoreTree]
[UmbracoTreeAuthorize(Constants.Trees.MemberTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, SortOrder = 2, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
public class MemberTypeTreeController : MemberTypeAndGroupTreeControllerBase, ISearchableTree
{
private readonly UmbracoTreeSearcher _treeSearcher;

View File

@@ -11,7 +11,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Packages)]
[Tree(Constants.Applications.Packages, Constants.Trees.Packages, SortOrder = 0, IsSingleNodeTree = true)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class PackagesTreeController : TreeController
{

View File

@@ -14,7 +14,7 @@ namespace Umbraco.Web.Trees
/// </summary>
[Tree(Constants.Applications.Settings, Constants.Trees.PartialViewMacros, SortOrder = 8, TreeGroup = Constants.Trees.Groups.Templating)]
[UmbracoTreeAuthorize(Constants.Trees.PartialViewMacros)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class PartialViewMacrosTreeController : PartialViewsTreeController
{

View File

@@ -17,7 +17,7 @@ namespace Umbraco.Web.Trees
/// </summary>
[Tree(Core.Constants.Applications.Settings, Core.Constants.Trees.PartialViews, SortOrder = 7, TreeGroup = Core.Constants.Trees.Groups.Templating)]
[UmbracoTreeAuthorize(Constants.Trees.PartialViews)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class PartialViewsTreeController : FileSystemTreeController
{

View File

@@ -14,7 +14,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.RelationTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.RelationTypes, SortOrder = 5, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class RelationTypeTreeController : TreeController
{

View File

@@ -21,7 +21,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Templates)]
[Tree(Constants.Applications.Settings, Constants.Trees.Templates, SortOrder = 6, TreeGroup = Constants.Trees.Groups.Templating)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class TemplatesTreeController : TreeController, ISearchableTree
{

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Users)]
[Tree(Constants.Applications.Users, Constants.Trees.Users, SortOrder = 0, IsSingleNodeTree = true)]
[PluginController("UmbracoTrees")]
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
public class UserTreeController : TreeController
{

View File

@@ -14,7 +14,7 @@ namespace Umbraco.Web.Common.ApplicationModels
public BackOfficeApplicationModelProvider(IModelMetadataProvider modelMetadataProvider)
{
ActionModelConventions = new List<IActionModelConvention>()
{
{
new BackOfficeIdentityCultureConvention()
};
}
@@ -52,7 +52,9 @@ namespace Umbraco.Web.Common.ApplicationModels
{
var pluginControllerAttribute = controller.Attributes.OfType<PluginControllerAttribute>().FirstOrDefault();
return pluginControllerAttribute != null
&& pluginControllerAttribute.AreaName == Core.Constants.Web.Mvc.BackOfficeArea;
&& (pluginControllerAttribute.AreaName == Core.Constants.Web.Mvc.BackOfficeArea
|| pluginControllerAttribute.AreaName == Core.Constants.Web.Mvc.BackOfficeApiArea
|| pluginControllerAttribute.AreaName == Core.Constants.Web.Mvc.BackOfficeTreeArea);
}
}
}

View File

@@ -12,6 +12,7 @@ namespace Umbraco.Web.Common.Filters
{
public void OnActionExecuted(ActionExecutedContext context)
{
}
public void OnActionExecuting(ActionExecutingContext context)