Error while adding Admin menu

Topics: Writing modules
Apr 17, 2013 at 4:16 PM
Hi,
I have developed one module which creates a Admin menu. Following a code I have used. But I am not able to create it. Please suggest.

AdminMenu.cs

public class AdminMenu : INavigationProvider {
    public Localizer T { get; set; }

    public AdminMenu() {
        T = NullLocalizer.Instance;
    }

    public string MenuName {
        get { return "admin"; }
    }

    public void GetNavigation(NavigationBuilder builder) {
      builder.AddImageSet("masterTables")
        .Add(T("Master Tables"), "2",
                    menu => menu.Add(T("Master Tables"), "0", item => item.Action("Index", "Admin", new { area = "CTLienSolutions.MasterTables" })
                                                                          .Permission(Permissions.ManageMasterTables)));
    }
}

Permissions.cs

public class Permissions : IPermissionProvider {
    public static readonly Permission ManageMasterTables = new Permission { Description = "Managing Master Tables", Name = "ManageMasterTables" };

    public virtual Feature Feature { get; set; }

    public IEnumerable<Permission> GetPermissions() {
        return new[]
               {
                   ManageMasterTables,
               };
    }

    public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
        return new[]
               {
                   new PermissionStereotype
                   {
                       Name = "Administrator",
                       Permissions = new[] {ManageMasterTables}
                   },
                   new PermissionStereotype
                   {
                       Name = "Editor",
                       Permissions = new[] {ManageMasterTables}
                   },
                   new PermissionStereotype
                   {
                       Name = "Moderator",
                   },
                   new PermissionStereotype
                   {
                       Name = "Author",
                       Permissions = new[] {ManageMasterTables}
                   },
                   new PermissionStereotype
                   {
                       Name = "Contributor",
                   },
               };
    }
}
Apr 17, 2013 at 4:51 PM
Do you mean that you expect a Master Tables menu item to appear in the admin menu, but you're not seeing it?
If so, did you verify that your GetNavigation gets hit? If not, make sure your feature is enabled and that there are no suspicious errors in the logs.
If it is getting hit, break your stuff down and add it back piece by piece. At some point it will stop working, and you'll know more.