Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Colin Anderson 7 posts 98 karma points
    Feb 13, 2020 @ 11:35
    Colin Anderson

    Adding custom context menu items to Umbraco 8

    I have managed to create a custom context menu item in Umbraco 8 using a Component and a Composer.

    The problem I have is that the new context menu item is available on every node (including Content and recycle bin) and for every user.

    Is it possible to restrict it to specific users/groups and to only show for a specific tree level?

  • Kevin Jump 1768 posts 11344 karma points MVP 4x c-trib
    Feb 13, 2020 @ 12:01
    Kevin Jump

    Hi Colin,

    Yes, you can get the current users assigned permissions within your MenuRendering method

    var permissions = sender.Services.UserService.GetPermissions(sender.Security.CurrentUser, nodeId);

    you can then check these either against inbuild permission actions or your own custom ones (implement IAction to make custom ones) for example

    if (permissions.Any(x => x.AssignedPermissions.Contains(ActionPublish.ActionLetter))) {
       /// user has publish permissions 

    you can restrict by node based on the ID the recylce bin has a special ID.

    so you can check if the node id passed matches that and ignore it.

    if (nodeId.Equals(Constants.System.RecycleBinContentString)) {
         // in the bin

    see for the inbuilt action classes

  • Colin Anderson 7 posts 98 karma points
    Feb 13, 2020 @ 12:20
    Colin Anderson

    Thanks Kevin, that did the trick.

Please Sign in or register to post replies

Write your reply to: