我们有以下代码成功地将菜单项添加到主菜单。
问题是,当我们授予用户编辑自己的内容时,用户看不到这个菜单项。只有我们授予站点所有者权限,用户才能看到它。
那是怎么回事?不应该授予用户编辑自己的内容来解决问题吗?
using System.Web;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Navigation.Models; // this doesn't resolve properly but still builds
using Orchard.Localization;
using Orchard.UI.Navigation;
using Orchard.Mvc.Routes;
using System.Collections.Generic;
using Orchard.Security.Permissions;
namespace BigFont.DealerDashboard.Services
{
public class DealerDashboardMenuProvider : IMenuProvider
{
private readonly IContentManager _contentManager;
public Localizer T { get; set; }
public DealerDashboardMenuProvider(
IContentManager contentManager)
{
_contentManager = contentManager;
T = NullLocalizer.Instance;
}
public void GetMenu(IContent menu, NavigationBuilder builder)
{
builder.Add(T("Dealers"), "2", subMenu => subMenu
.Url("~/Dealers")
.Permission(Orchard.Core.Contents.Permissions.EditOwnContent)
);
}
}
}