diff --git a/src/Umbraco.Core/Services/UserServiceExtensions.cs b/src/Umbraco.Core/Services/UserServiceExtensions.cs
index 31c446352e..82cab07b25 100644
--- a/src/Umbraco.Core/Services/UserServiceExtensions.cs
+++ b/src/Umbraco.Core/Services/UserServiceExtensions.cs
@@ -104,5 +104,17 @@ namespace Umbraco.Core.Services
return found;
}
+
+ ///
+ /// Gets the concrete assigned permissions for the provided user and node
+ ///
+ ///
+ ///
+ ///
+ internal static string[] GetAssignedPermissions(this IUserService userService, IUser user, int nodeId)
+ {
+ var permissionCollection = userService.GetPermissions(user, nodeId);
+ return permissionCollection.SelectMany(c => c.AssignedPermissions).Distinct().ToArray();
+ }
}
}
diff --git a/src/Umbraco.Web/Actions/ActionCollection.cs b/src/Umbraco.Web/Actions/ActionCollection.cs
index 89ac8a59f4..95d7b02e90 100644
--- a/src/Umbraco.Web/Actions/ActionCollection.cs
+++ b/src/Umbraco.Web/Actions/ActionCollection.cs
@@ -28,15 +28,5 @@ namespace Umbraco.Web.Actions
.WhereNotNull()
.ToList();
}
-
- internal IReadOnlyList FromEntityPermission(EntityPermission entityPermission)
- {
- var actions = this.ToArray(); // no worry: internally, it's already an array
- return entityPermission.AssignedPermissions
- .Where(x => x.Length == 1)
- .SelectMany(x => actions.Where(y => y.Letter == x[0]))
- .WhereNotNull()
- .ToList();
- }
}
}
diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs
index d19c066861..361912b2bd 100644
--- a/src/Umbraco.Web/Editors/ContentController.cs
+++ b/src/Umbraco.Web/Editors/ContentController.cs
@@ -1679,9 +1679,9 @@ namespace Umbraco.Web.Editors
throw new HttpResponseException(response);
}
- var permission = Services.UserService.GetPermissions(Security.CurrentUser, node.Path);
+ var assignedPermissions = Services.UserService.GetAssignedPermissions(Security.CurrentUser, node.Id);
- if (permission.AssignedPermissions.Contains(ActionAssignDomain.ActionLetter.ToString(), StringComparer.Ordinal) == false)
+ if (assignedPermissions.Contains(ActionAssignDomain.ActionLetter.ToString(), StringComparer.Ordinal) == false)
{
var response = Request.CreateResponse(HttpStatusCode.BadRequest);
response.Content = new StringContent("You do not have permission to assign domains on that node.");
diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs
index 3373a6fa8b..85ff30487d 100644
--- a/src/Umbraco.Web/Trees/ContentTreeController.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeController.cs
@@ -129,8 +129,8 @@ namespace Umbraco.Web.Trees
menu.DefaultMenuAlias = ActionNew.ActionAlias;
// we need to get the default permissions as you can't set permissions on the very root node
- var permission = Services.UserService.GetPermissions(Security.CurrentUser, Constants.System.Root).First();
- var nodeActions = _actions.FromEntityPermission(permission)
+ var assignedPermissions = Services.UserService.GetAssignedPermissions(Security.CurrentUser, Constants.System.Root);
+ var nodeActions = _actions.GetByLetters(assignedPermissions)
.Select(x => new MenuItem(x));
//these two are the standard items
diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
index c3458f93a2..7bd69dba4b 100644
--- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
@@ -454,8 +454,8 @@ namespace Umbraco.Web.Trees
internal IEnumerable