Table of Contents

Class ContentTreeControllerBase

Namespace
Umbraco.Cms.Web.BackOffice.Trees
Assembly
Umbraco.Web.BackOffice.dll
public abstract class ContentTreeControllerBase : TreeController, ITree, ITreeNodeController
Inheritance
ContentTreeControllerBase
Implements
ITree
Derived
Inherited Members

Constructors

ContentTreeControllerBase(ILocalizedTextService, UmbracoApiControllerTypeCollection, IMenuItemCollectionFactory, IEntityService, IBackOfficeSecurityAccessor, ILogger<ContentTreeControllerBase>, ActionCollection, IUserService, IDataTypeService, IEventAggregator, AppCaches)

protected ContentTreeControllerBase(ILocalizedTextService localizedTextService, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, IMenuItemCollectionFactory menuItemCollectionFactory, IEntityService entityService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, ILogger<ContentTreeControllerBase> logger, ActionCollection actionCollection, IUserService userService, IDataTypeService dataTypeService, IEventAggregator eventAggregator, AppCaches appCaches)

Parameters

localizedTextService ILocalizedTextService
umbracoApiControllerTypeCollection UmbracoApiControllerTypeCollection
menuItemCollectionFactory IMenuItemCollectionFactory
entityService IEntityService
backofficeSecurityAccessor IBackOfficeSecurityAccessor
logger ILogger<ContentTreeControllerBase>
actionCollection ActionCollection
userService IUserService
dataTypeService IDataTypeService
eventAggregator IEventAggregator
appCaches AppCaches

Properties

MenuItemCollectionFactory

public IMenuItemCollectionFactory MenuItemCollectionFactory { get; }

Property Value

IMenuItemCollectionFactory

RecycleBinId

Returns the

protected abstract int RecycleBinId { get; }

Property Value

int

RecycleBinSmells

Returns true if the recycle bin has items in it

protected abstract bool RecycleBinSmells { get; }

Property Value

bool

UmbracoObjectType

protected abstract UmbracoObjectTypes UmbracoObjectType { get; }

Property Value

UmbracoObjectTypes

UserStartNodes

Returns the user's start node for this tree

protected abstract int[] UserStartNodes { get; }

Property Value

int[]

Methods

CreateRootNode(FormCollection)

Ensure the noAccess metadata is applied for the root node if in dialog mode and the user doesn't have path access to it

protected override ActionResult<TreeNode?> CreateRootNode(FormCollection queryStrings)

Parameters

queryStrings FormCollection

Returns

ActionResult<TreeNode>

FilterUserAllowedMenuItems(MenuItemCollection, IEnumerable<MenuItem>)

Based on the allowed actions, this will filter the ones that the current user is allowed

protected void FilterUserAllowedMenuItems(MenuItemCollection menuWithAllItems, IEnumerable<MenuItem> userAllowedMenuItems)

Parameters

menuWithAllItems MenuItemCollection
userAllowedMenuItems IEnumerable<MenuItem>

GetChildEntities(string, FormCollection)

protected virtual ActionResult<IEnumerable<IEntitySlim>> GetChildEntities(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<IEnumerable<IEntitySlim>>

GetMenuForNode(string, FormCollection)

Checks if the menu requested is for the recycle bin and renders that, otherwise renders the result of PerformGetMenuForNode

protected override sealed ActionResult<MenuItemCollection> GetMenuForNode(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<MenuItemCollection>

GetSingleTreeNode(IEntitySlim, string, FormCollection?)

protected abstract TreeNode? GetSingleTreeNode(IEntitySlim entity, string parentId, FormCollection? queryStrings)

Parameters

entity IEntitySlim
parentId string
queryStrings FormCollection

Returns

TreeNode

GetTreeNode(string, FormCollection?)

Gets an individual tree node

public ActionResult<TreeNode?> GetTreeNode(string id, FormCollection? queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<TreeNode>

GetTreeNodes(string, FormCollection)

Ensures the recycle bin is appended when required (i.e. user has access to the root and it's not in dialog mode)

protected override sealed ActionResult<TreeNodeCollection> GetTreeNodes(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<TreeNodeCollection>

Remarks

This method is overwritten strictly to render the recycle bin, it should serve no other purpose

HasPathAccess(string, FormCollection)

Returns true or false if the current user has access to the node based on the user's allowed start node (path) access

protected abstract bool HasPathAccess(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

bool

HasPathAccess(IUmbracoEntity?, FormCollection)

Returns true or false if the current user has access to the node based on the user's allowed start node (path) access

protected bool HasPathAccess(IUmbracoEntity? entity, FormCollection queryStrings)

Parameters

entity IUmbracoEntity
queryStrings FormCollection

Returns

bool

PerformGetMenuForNode(string, FormCollection)

protected abstract ActionResult<MenuItemCollection> PerformGetMenuForNode(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<MenuItemCollection>

PerformGetTreeNodes(string, FormCollection)

protected virtual ActionResult<TreeNodeCollection> PerformGetTreeNodes(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<TreeNodeCollection>

ShouldRenderChildrenOfContainer(IEntitySlim)

Check to see if we should return children of a container node

protected bool ShouldRenderChildrenOfContainer(IEntitySlim e)

Parameters

e IEntitySlim

Returns

bool

Remarks

This is required in case a user has custom start nodes that are children of a list view since in that case we'll need to render the tree node. In normal cases we don't render children of a list view.