' +
'
' +
'
' +
@@ -310,6 +310,25 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
}
+ /** Returns the css classses assigned to the node (div element) */
+ scope.getNodeCssClass = function (node) {
+ if (!node) {
+ return '';
+ }
+
+ //TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time
+ // it would be better if we could cache the processing. The problem is that some of these things are dynamic.
+
+ var css = [];
+ if (node.cssClasses) {
+ _.each(node.cssClasses, function (c) {
+ css.push(c);
+ });
+ }
+
+ return css.join(" ");
+ };
+
scope.selectEnabledNodeClass = function (node) {
return node ?
node.selected ?
@@ -383,6 +402,12 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
defined on the tree
*/
scope.select = function (n, ev) {
+
+ if (n.metaData && n.metaData.noAccess === true) {
+ ev.preventDefault();
+ return;
+ }
+
//on tree select we need to remove the current node -
// whoever handles this will need to make sure the correct node is selected
//reset current node selection
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js
index 03ef2cdfb4..ce74767007 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js
@@ -111,7 +111,11 @@ angular.module("umbraco.directives")
scope.getNodeCssClass = function (node) {
if (!node) {
return '';
- }
+ }
+
+ //TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time
+ // it would be better if we could cache the processing. The problem is that some of these things are dynamic.
+
var css = [];
if (node.cssClasses) {
_.each(node.cssClasses, function(c) {
@@ -120,7 +124,8 @@ angular.module("umbraco.directives")
}
if (node.selected) {
css.push("umb-tree-node-checked");
- }
+ }
+
return css.join(" ");
};
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js
index 325aa4690f..888a067a66 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js
@@ -44,6 +44,14 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
if (!parentNode.section) {
parentNode.section = section;
}
+
+ if (parentNode.metaData && parentNode.metaData.noAccess === true) {
+ if (!parentNode.cssClasses) {
+ parentNode.cssClasses = [];
+ }
+ parentNode.cssClasses.push("no-access");
+ }
+
//create a method outside of the loop to return the parent - otherwise jshint blows up
var funcParent = function() {
return parentNode;
diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
index c025f027cb..8fabc1677e 100644
--- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
@@ -54,6 +54,23 @@ namespace Umbraco.Web.Trees
}
#endregion
+
+ ///
+ /// 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 TreeNode CreateRootNode(FormDataCollection queryStrings)
+ {
+ var node = base.CreateRootNode(queryStrings);
+
+ if (IsDialog(queryStrings) && UserStartNodes.Contains(Constants.System.Root) == false)
+ {
+ node.AdditionalData["noAccess"] = true;
+ }
+
+ return node;
+ }
protected abstract TreeNode GetSingleTreeNode(IUmbracoEntity e, string parentId, FormDataCollection queryStrings);