Updated DB and business logic to support multiple starts nodes for a user and for user groups to have start nodes - U4-9915 User Groups will have a start node assigned and Users can have multiple start nodes assigned

This commit is contained in:
Shannon
2017-05-25 02:03:41 +10:00
parent 38837049f0
commit dec9422531
70 changed files with 774 additions and 421 deletions

View File

@@ -68,7 +68,7 @@ namespace Umbraco.Web.Trees
/// <summary>
/// Returns the user's start node for this tree
/// </summary>
protected abstract int UserStartNode { get; }
protected abstract int[] UserStartNodes { get; }
/// <summary>
/// Gets the tree nodes for the given id
@@ -105,7 +105,7 @@ namespace Umbraco.Web.Trees
// Therefore, in the latter case, we want to change the id to -1 since we want to render the current user's root node
// and the GetChildEntities method will take care of rendering the correct root node.
// If it is in dialog mode, then we don't need to change anything and the children will just render as per normal.
if (IsDialog(queryStrings) == false && UserStartNode != Constants.System.Root)
if (IsDialog(queryStrings) == false && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.System.Root) == false)
{
id = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
}
@@ -139,17 +139,11 @@ namespace Umbraco.Web.Trees
//if a request is made for the root node data but the user's start node is not the default, then
// we need to return their start node data
if (iid == Constants.System.Root && UserStartNode != Constants.System.Root)
// we need to return their start nodes
if (iid == Constants.System.Root && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.System.Root) == false)
{
//just return their single start node, it will show up under the 'Content' label
var startNode = Services.EntityService.Get(UserStartNode, UmbracoObjectType);
if (startNode != null)
return new[] { startNode };
else
{
throw new EntityNotFoundException(UserStartNode, "User's start content node could not be found");
}
var nodes = Services.EntityService.GetAll(UmbracoObjectType, UserStartNodes);
return nodes;
}
return Services.EntityService.GetChildren(iid, UmbracoObjectType).ToArray();
@@ -175,7 +169,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() && UserStartNode == Constants.System.Root)
if (id == Constants.System.Root.ToInvariantString() && (UserStartNodes.Length == 0 || UserStartNodes.Contains(Constants.System.Root)))
{
var altStartId = string.Empty;