Browse Source
Add feature check for CmsKit Page Middleware
pull/17282/head
Enis Necipoglu
3 years ago
No known key found for this signature in database
GPG Key ID: 1EC55E13241E1680
1 changed files with
9 additions and
0 deletions
-
modules/cms-kit/src/Volo.CmsKit.Public.Web/DefaultHomePageMiddleware.cs
|
|
|
@ -3,6 +3,8 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.Features; |
|
|
|
using Volo.CmsKit.Features; |
|
|
|
using Volo.CmsKit.Pages; |
|
|
|
using Volo.CmsKit.Public.Pages; |
|
|
|
|
|
|
|
@ -12,6 +14,13 @@ public class DefaultHomePageMiddleware : IMiddleware, ITransientDependency |
|
|
|
{ |
|
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next) |
|
|
|
{ |
|
|
|
var featureChecker = context.RequestServices.GetRequiredService<IFeatureChecker>(); |
|
|
|
|
|
|
|
if (!await featureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable)) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (context.Request.Path.Value == "/") |
|
|
|
{ |
|
|
|
var pagePublicAppService = context.RequestServices.GetRequiredService<IPagePublicAppService>(); |
|
|
|
|