|
|
|
@ -1,4 +1,8 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using ProductManagement.Localization; |
|
|
|
using Volo.Abp.UI.Navigation; |
|
|
|
|
|
|
|
namespace ProductManagement |
|
|
|
@ -13,11 +17,20 @@ namespace ProductManagement |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private Task ConfigureMainMenu(MenuConfigurationContext context) |
|
|
|
private async Task ConfigureMainMenu(MenuConfigurationContext context) |
|
|
|
{ |
|
|
|
//Add main menu items.
|
|
|
|
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>(); |
|
|
|
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<ProductManagementResource>>(); |
|
|
|
|
|
|
|
return Task.CompletedTask; |
|
|
|
|
|
|
|
var rootMenuItem = new ApplicationMenuItem("ProductManagement", l["Menu:ProductManagement"]); |
|
|
|
|
|
|
|
if (await authorizationService.IsGrantedAsync(ProductManagementPermissions.Products.Default)) |
|
|
|
{ |
|
|
|
rootMenuItem.AddItem(new ApplicationMenuItem("Products", l["Menu:Products"], "/ProductManagement/Products")); |
|
|
|
} |
|
|
|
|
|
|
|
context.Menu.AddItem(rootMenuItem); |
|
|
|
} |
|
|
|
} |
|
|
|
} |