diff --git a/src/Umbraco.Core/Models/UserExtensions.cs b/src/Umbraco.Core/Models/UserExtensions.cs index f9aa1113b3..14f3cdaca8 100644 --- a/src/Umbraco.Core/Models/UserExtensions.cs +++ b/src/Umbraco.Core/Models/UserExtensions.cs @@ -151,7 +151,7 @@ namespace Umbraco.Core.Models internal static bool HasContentRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.Root.ToInvariantString(), user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); } internal static bool HasContentBinAccess(this IUser user, IEntityService entityService) @@ -161,7 +161,7 @@ namespace Umbraco.Core.Models internal static bool HasMediaRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.Root.ToInvariantString(), user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); } internal static bool HasMediaBinAccess(this IUser user, IEntityService entityService) @@ -327,7 +327,7 @@ namespace Umbraco.Core.Models ? entityService.GetAllPaths(objectType, asn).ToDictionary(x => x.Id, x => x.Path) : new Dictionary(); - paths[Constants.System.Root] = Constants.System.Root.ToString(); // entityService does not get that one + paths[Constants.System.Root] = Constants.System.RootString; // entityService does not get that one var binPath = GetBinPath(objectType); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index e9b952f11d..924efa1e11 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -61,7 +61,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement // move to parent (or -1), update path, save moving.ParentId = parentId; var movingPath = moving.Path + ","; // save before changing - moving.Path = (container == null ? Constants.System.Root.ToString() : container.Path) + "," + moving.Id; + moving.Path = (container == null ? Constants.System.RootString : container.Path) + "," + moving.Id; moving.Level = container == null ? 1 : container.Level + 1; Save(moving); diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index f2bef52922..ef1d61d4a8 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -533,7 +533,7 @@ namespace Umbraco.Core.Services.Implement //null check otherwise we get exceptions if (content.Path.IsNullOrWhiteSpace()) return Enumerable.Empty(); - var rootId = Constants.System.Root.ToInvariantString(); + var rootId = Constants.System.RootString; var ids = content.Path.Split(',') .Where(x => x != rootId && x != content.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray(); if (ids.Any() == false) diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index bd6b837c2c..3f1ffa55d9 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -94,7 +94,7 @@ namespace Umbraco.Web.Editors // if the parentId is root (-1) then we just need an empty string as we are // creating the path below and we don't want -1 in the path - if (parentId == Core.Constants.System.Root.ToInvariantString()) + if (parentId == Core.Constants.System.RootString) { parentId = string.Empty; } @@ -276,7 +276,7 @@ namespace Umbraco.Web.Editors // Make sure that the root virtual path ends with '/' codeFileDisplay.VirtualPath = codeFileDisplay.VirtualPath.EnsureEndsWith("/"); - if (id != Core.Constants.System.Root.ToInvariantString()) + if (id != Core.Constants.System.RootString) { codeFileDisplay.VirtualPath += id.TrimStart("/").EnsureEndsWith("/"); //if it's not new then it will have a path, otherwise it won't diff --git a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs b/src/Umbraco.Web/Models/Trees/TreeRootNode.cs index 730f6e2962..e26dffe5e4 100644 --- a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs +++ b/src/Umbraco.Web/Models/Trees/TreeRootNode.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Models.Trees [DataContract(Name = "node", Namespace = "")] public sealed class TreeRootNode : TreeNode { - private static readonly string RootId = Core.Constants.System.Root.ToString(CultureInfo.InvariantCulture); + private static readonly string RootId = Core.Constants.System.RootString; private bool _isGroup; private bool _isSingleNodeTree; diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 007fd53e60..f0a860496e 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -71,7 +71,7 @@ namespace Umbraco.Web.Trees //if there are no trees defined for this section but the section is defined then we can have a simple //full screen section without trees var name = Services.TextService.Localize("sections/" + application); - return TreeRootNode.CreateSingleTreeRoot(Constants.System.Root.ToInvariantString(), null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(Constants.System.RootString, null, null, name, TreeNodeCollection.Empty, true); } // handle request for a specific tree / or when there is only one tree @@ -114,7 +114,7 @@ namespace Umbraco.Web.Trees // otherwise it's a section with all empty trees, aka a fullscreen section // todo is this true? what if we just failed to TryGetRootNode on all of them? SD: Yes it's true but we should check the result of TryGetRootNode and throw? - return TreeRootNode.CreateSingleTreeRoot(Constants.System.Root.ToInvariantString(), null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(Constants.System.RootString, null, null, name, TreeNodeCollection.Empty, true); } // for many groups @@ -180,7 +180,7 @@ namespace Umbraco.Web.Trees var rootNode = await GetRootNode(tree, querystring); var sectionRoot = TreeRootNode.CreateSingleTreeRoot( - Constants.System.Root.ToInvariantString(), + Constants.System.RootString, rootNode.ChildNodesUrl, rootNode.MenuUrl, rootNode.Name, diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index 87a707102d..8c23a91d5a 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Trees var entities = Services.EntityService.GetChildren(Constants.System.Root, UmbracoObjectTypes.DocumentBlueprint).ToArray(); //check if we're rendering the root in which case we'll render the content types that have blueprints - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //get all blueprint content types var contentTypeAliases = entities.Select(x => ((ContentEntitySlim) x).ContentTypeAlias).Distinct(); @@ -91,7 +91,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { // root actions menu.Items.Add(Services.TextService, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index b90e1964b8..4249d1639e 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -109,7 +109,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings) { - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { var menu = new MenuItemCollection(); diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index e521deca40..0c02dd6e46 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -120,7 +120,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - var rootIdString = Constants.System.Root.ToString(CultureInfo.InvariantCulture); + var rootIdString = Constants.System.RootString; var hasAccessToRoot = UserStartNodes.Contains(Constants.System.Root); var startNodeId = queryStrings.HasKey(TreeQueryStringParameters.StartNodeId) @@ -256,7 +256,7 @@ namespace Umbraco.Web.Trees protected sealed override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { //check if we're rendering the root - if (id == Constants.System.Root.ToInvariantString() && UserStartNodes.Contains(Constants.System.Root)) + if (id == Constants.System.RootString && UserStartNodes.Contains(Constants.System.Root)) { var altStartId = string.Empty; @@ -264,7 +264,7 @@ namespace Umbraco.Web.Trees altStartId = queryStrings.GetValue(TreeQueryStringParameters.StartNodeId); //check if a request has been made to render from a specific start node - if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.System.Root.ToString(CultureInfo.InvariantCulture)) + if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.System.RootString) { id = altStartId; } @@ -272,7 +272,7 @@ namespace Umbraco.Web.Trees var nodes = GetTreeNodesInternal(id, queryStrings); //only render the recycle bin if we are not in dialog and the start id id still the root - if (IsDialog(queryStrings) == false && id == Constants.System.Root.ToInvariantString()) + if (IsDialog(queryStrings) == false && id == Constants.System.RootString) { nodes.Add(CreateTreeNode( RecycleBinId.ToInvariantString(), diff --git a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs index 66cb9fe36e..b8374f9d94 100644 --- a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/DataTypeTreeController.cs b/src/Umbraco.Web/Trees/DataTypeTreeController.cs index 8a0a83d94f..a9e29697fc 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -96,7 +96,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/DictionaryTreeController.cs b/src/Umbraco.Web/Trees/DictionaryTreeController.cs index 5f0b7b5df0..3f7b89bcdf 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Trees Func ItemSort() => item => item.ItemKey; - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { nodes.AddRange( Services.LocalizationService.GetRootDictionaryItems().OrderBy(ItemSort()).Select( @@ -104,7 +104,7 @@ namespace Umbraco.Web.Trees menu.Items.Add(Services.TextService, opensDialog: true); - if (id != Constants.System.Root.ToInvariantString()) + if (id != Constants.System.RootString) menu.Items.Add(Services.TextService, true, opensDialog: true); menu.Items.Add(new RefreshNode(Services.TextService, true)); diff --git a/src/Umbraco.Web/Trees/FileSystemTreeController.cs b/src/Umbraco.Web/Trees/FileSystemTreeController.cs index 9aea6e03dd..6e21c8114f 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.Trees protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { - var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString() + var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; @@ -84,7 +84,7 @@ namespace Umbraco.Web.Trees { var root = base.CreateRootNode(queryStrings); //check if there are any children - root.HasChildren = GetTreeNodes(Constants.System.Root.ToInvariantString(), queryStrings).Any(); + root.HasChildren = GetTreeNodes(Constants.System.RootString, queryStrings).Any(); return root; } @@ -139,14 +139,14 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { //if root node no need to visit the filesystem so lets just create the menu and return it - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { return GetMenuForRootNode(queryStrings); } var menu = new MenuItemCollection(); - var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString() + var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; diff --git a/src/Umbraco.Web/Trees/MacrosTreeController.cs b/src/Umbraco.Web/Trees/MacrosTreeController.cs index 77b13416ff..02636cbea8 100644 --- a/src/Umbraco.Web/Trees/MacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/MacrosTreeController.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { foreach (var macro in Services.MacroService.GetAll()) { @@ -50,7 +50,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //Create the normal create action menu.Items.Add(Services.TextService); diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index 5797dd930d..fc3d23f092 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -86,7 +86,7 @@ namespace Umbraco.Web.Trees //set the default menu.DefaultMenuAlias = ActionNew.ActionAlias; - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { // if the user's start node is not the root then the only menu item to display is refresh if (UserStartNodes.Contains(Constants.System.Root) == false) diff --git a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs index 30db2ea12a..bb6b867751 100644 --- a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs @@ -65,7 +65,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/MemberTreeController.cs b/src/Umbraco.Web/Trees/MemberTreeController.cs index 6107540c0c..bb0091af54 100644 --- a/src/Umbraco.Web/Trees/MemberTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberTreeController.cs @@ -121,7 +121,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { nodes.Add( CreateTreeNode(Constants.Conventions.MemberTypes.AllMembersListId, id, queryStrings, Services.TextService.Localize("member/allMembers"), "icon-users", true, @@ -148,7 +148,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { // root actions if (_provider.IsUmbracoMembershipProvider()) diff --git a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs index d3f9ee77c9..5e71266bca 100644 --- a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { // root actions menu.Items.Add(new CreateChildEntity(Services.TextService)); diff --git a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs index 82e07c5226..ab6dd39820 100644 --- a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //Create the normal create action menu.Items.Add(Services.TextService.Localize("actions", ActionNew.ActionAlias)); @@ -41,7 +41,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { nodes.AddRange(Services.RelationService.GetAllRelationTypes() .Select(rt => CreateTreeNode(rt.Id.ToString(), id, queryStrings, rt.Name, diff --git a/src/Umbraco.Web/Trees/TemplatesTreeController.cs b/src/Umbraco.Web/Trees/TemplatesTreeController.cs index 916e5d4b4d..601964c30d 100644 --- a/src/Umbraco.Web/Trees/TemplatesTreeController.cs +++ b/src/Umbraco.Web/Trees/TemplatesTreeController.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - var found = id == Constants.System.Root.ToInvariantString() + var found = id == Constants.System.RootString ? Services.FileService.GetTemplates(-1) : Services.FileService.GetTemplates(int.Parse(id)); @@ -77,7 +77,7 @@ namespace Umbraco.Web.Trees var item = menu.Items.Add(Services.TextService, opensDialog: true); item.NavigateToRoute($"{queryStrings.GetRequiredValue("application")}/templates/edit/{id}?create=true"); - if (id == Constants.System.Root.ToInvariantString()) + if (id == Constants.System.RootString) { //refresh action menu.Items.Add(new RefreshNode(Services.TextService, true)); diff --git a/src/Umbraco.Web/Trees/TreeControllerBase.cs b/src/Umbraco.Web/Trees/TreeControllerBase.cs index 4e43e6c093..daa8300b4f 100644 --- a/src/Umbraco.Web/Trees/TreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/TreeControllerBase.cs @@ -173,7 +173,7 @@ namespace Umbraco.Web.Trees /// protected virtual TreeNode CreateRootNode(FormDataCollection queryStrings) { - var rootNodeAsString = Constants.System.Root.ToString(CultureInfo.InvariantCulture); + var rootNodeAsString = Constants.System.RootString; var currApp = queryStrings.GetValue(TreeQueryStringParameters.Application); var node = new TreeNode(