-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1026 from DFE-Digital/bugfix/committee-spelling-fix
Spelling fix and maintenance mode flag
- Loading branch information
Showing
6 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Dfe.PrepareConversions/Dfe.PrepareConversions/Routing/MaintenancePageFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Primitives; | ||
using System.Threading.Tasks; | ||
|
||
namespace Dfe.PrepareConversions.Routing | ||
{ | ||
public class MaintenancePageFilter : IAsyncPageFilter | ||
{ | ||
private readonly IConfiguration _config; | ||
|
||
public MaintenancePageFilter(IConfiguration config) | ||
{ | ||
_config = config; | ||
} | ||
|
||
public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, | ||
PageHandlerExecutionDelegate next) | ||
{ | ||
bool maintenanceMode = bool.Parse(_config["MaintenanceMode"]); | ||
|
||
if (maintenanceMode && !context.ActionDescriptor.DisplayName.Contains("Maintenance")) | ||
{ | ||
context.Result = new RedirectToPageResult("/public/maintenance"); | ||
return; | ||
} | ||
|
||
// Do post work. | ||
await next.Invoke(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters