Open Closed

When Add new module root menu keep showing without login #4731


User avatar
0
fadijb created

When Add new module root menu keep showing without login


  • ABP Framework version: v7.0.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share code of your IMenuContributor

  • User Avatar
    0
    fadijb created
       public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }
    
            var moduleMenu = AddModuleMenuItem(context); //Do not delete `moduleMenu` variable as it will be used by ABP Suite!
    
            AddMenuItemNationalities(context, moduleMenu);
    
            AddMenuItemCountries(context, moduleMenu);
    
            AddMenuItemCities(context, moduleMenu);
        }
    
        private static ApplicationMenuItem AddModuleMenuItem(MenuConfigurationContext context)
        {
            var moduleMenu = new ApplicationMenuItem(
                MainSettingMenus.Prefix,
                context.GetLocalizer<MainSettingResource>()["Menu:MainSetting"],
                "~/MainSetting",
                icon: "fas fa-cogs"
                );
    
            //Add main menu items.
            context.Menu.Items.AddIfNotContains(moduleMenu);
            return moduleMenu;
        }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can check the login status, permissions, features..

    var moduleMenu = new ApplicationMenuItem(
        MainSettingMenus.Prefix,
        context.GetLocalizer<MainSettingResource>()["Menu:MainSetting"],
        "~/MainSetting",
        icon: "fas fa-cogs"
        )
        .RequireAuthenticated()
        .RequirePermissions(CmsKitAdminPermissions.GlobalResources.Default)
        .RequireFeatures()
        .RequireGlobalFeatures();
    
  • User Avatar
    0
    fadijb created
    var moduleMenu = new ApplicationMenuItem(
            MainSettingMenus.Prefix,
            context.GetLocalizer&lt;MainSettingResource&gt;()["Menu:MainSetting"],
            //"~/MainSetting",
            icon: "fas fa-cogs"
            );
            
    

    I just remove this line

    //"~/MainSetting",

    its woking thank you

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11