Fixes tree for single tree sections, fixes creating a user group so you can select default permissions
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Umbraco.Web.Trees
|
||||
//find all tree definitions that have the current application alias
|
||||
var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, onlyInitialized).ToArray();
|
||||
|
||||
if (appTrees.Count() == 1 || string.IsNullOrEmpty(tree) == false )
|
||||
if (string.IsNullOrEmpty(tree) == false || appTrees.Length == 1)
|
||||
{
|
||||
var apptree = string.IsNullOrEmpty(tree) == false
|
||||
? appTrees.SingleOrDefault(x => x.Alias == tree)
|
||||
@@ -55,11 +55,12 @@ namespace Umbraco.Web.Trees
|
||||
Constants.System.Root.ToString(CultureInfo.InvariantCulture),
|
||||
queryStrings,
|
||||
application);
|
||||
|
||||
return result;
|
||||
|
||||
//this will be null if it cannot convert to ta single root section
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var collection = new TreeNodeCollection();
|
||||
foreach (var apptree in appTrees)
|
||||
{
|
||||
@@ -107,6 +108,7 @@ namespace Umbraco.Web.Trees
|
||||
/// <param name="configTree"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="queryStrings"></param>
|
||||
/// <param name="application"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<SectionRootNode> GetRootForSingleAppTree(ApplicationTree configTree, string id, FormDataCollection queryStrings, string application)
|
||||
{
|
||||
@@ -121,6 +123,16 @@ namespace Umbraco.Web.Trees
|
||||
//This should really never happen if we've successfully got the children above.
|
||||
throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias);
|
||||
}
|
||||
|
||||
//if the root node has a route path, we cannot create a single root section because by specifying the route path this would
|
||||
//override the dashboard route and that means there can be no dashboard for that section which is a breaking change.
|
||||
if (rootNode.Result.RoutePath.IsNullOrWhiteSpace() == false
|
||||
&& rootNode.Result.RoutePath != "#"
|
||||
&& rootNode.Result.RoutePath != application)
|
||||
{
|
||||
//null indicates this cannot be converted
|
||||
return null;
|
||||
}
|
||||
|
||||
var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
|
||||
rootId,
|
||||
@@ -128,6 +140,10 @@ namespace Umbraco.Web.Trees
|
||||
rootNode.Result.MenuUrl,
|
||||
rootNode.Result.Name,
|
||||
byControllerAttempt.Result);
|
||||
|
||||
//This can't be done currently because the root will default to routing to a dashboard and if we disable dashboards for a section
|
||||
//that is really considered a breaking change. See above.
|
||||
//sectionRoot.RoutePath = rootNode.Result.RoutePath;
|
||||
|
||||
foreach (var d in rootNode.Result.AdditionalData)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user