|
|
|
@ -1,7 +1,7 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.UI.Navigation; |
|
|
|
using Volo.Blogging.Localization; |
|
|
|
|
|
|
|
@ -22,23 +22,17 @@ namespace Volo.Blogging |
|
|
|
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>(); |
|
|
|
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<BloggingResource>>(); |
|
|
|
|
|
|
|
if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Default)) |
|
|
|
if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Management)) |
|
|
|
{ |
|
|
|
var rootMenuItem = new ApplicationMenuItem("Blogs", l["Menu:Blogs"], "/Blog"); |
|
|
|
|
|
|
|
context.Menu.AddItem(rootMenuItem); |
|
|
|
var managementRootMenuItem = new ApplicationMenuItem("BlogManagement", l["Menu:BlogManagement"]); |
|
|
|
|
|
|
|
//TODO: Using the same permission. Reconsider.
|
|
|
|
if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Management)) |
|
|
|
{ |
|
|
|
var managementRootMenuItem = new ApplicationMenuItem("BlogManagement", l["Menu:BlogManagement"]); |
|
|
|
|
|
|
|
if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Management)) |
|
|
|
{ |
|
|
|
managementRootMenuItem.AddItem(new ApplicationMenuItem("BlogsAdmin", l["Menu:Blogs"], "/Admin/Blogs")); |
|
|
|
} |
|
|
|
|
|
|
|
context.Menu.AddItem(managementRootMenuItem); |
|
|
|
managementRootMenuItem.AddItem(new ApplicationMenuItem("BlogManagement.Blogs", l["Menu:Blogs"], "/Admin/Blogs")); |
|
|
|
} |
|
|
|
|
|
|
|
context.Menu.AddItem(managementRootMenuItem); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|