protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings)
        {
            if (id == Constants.System.RootString)
            {
                var menu = new MenuItemCollection();

                // if the user's start node is not the root then the only menu item to display is refresh
                if (UserStartNodes.Contains(Constants.System.Root) == false)
                {
                    menu.Items.Add(new RefreshNode(Services.TextService, true));
                    return(menu);
                }

                //set the default to create
                menu.DefaultMenuAlias = ActionNew.ActionAlias;

                // we need to get the default permissions as you can't set permissions on the very root node
                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
                menu.Items.Add <ActionNew>(Services.TextService, opensDialog: true);
                menu.Items.Add <ActionSort>(Services.TextService, true);

                //filter the standard items
                FilterUserAllowedMenuItems(menu, nodeActions);

                if (menu.Items.Any())
                {
                    menu.Items.Last().SeparatorBefore = true;
                }

                // add default actions for *all* users
                menu.Items.Add(new RefreshNode(Services.TextService, true));

                return(menu);
            }


            //return a normal node menu:
            int iid;

            if (int.TryParse(id, out iid) == false)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            var item = Services.EntityService.Get(iid, UmbracoObjectTypes.Document);

            if (item == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            //if the user has no path access for this node, all they can do is refresh
            if (!Security.CurrentUser.HasContentPathAccess(item, Services.EntityService))
            {
                var menu = new MenuItemCollection();
                menu.Items.Add(new RefreshNode(Services.TextService, true));
                return(menu);
            }

            var nodeMenu = GetAllNodeMenuItems(item);

            //if the content node is in the recycle bin, don't have a default menu, just show the regular menu
            if (item.Path.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString()))
            {
                nodeMenu.DefaultMenuAlias = null;
                nodeMenu = GetNodeMenuItemsForDeletedContent(item);
            }
            else
            {
                //set the default to create
                nodeMenu.DefaultMenuAlias = ActionNew.ActionAlias;
            }

            var allowedMenuItems = GetAllowedUserMenuItemsForNode(item);

            FilterUserAllowedMenuItems(nodeMenu, allowedMenuItems);

            return(nodeMenu);
        }
        internal IEnumerable <MenuItem> GetAllowedUserMenuItemsForNode(IUmbracoEntity dd)
        {
            var permissionsForPath = _userService.GetPermissionsForPath(_backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser, dd.Path).GetAllPermissions();

            return(_actionCollection.GetByLetters(permissionsForPath).Select(x => new MenuItem(x)));
        }