diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index ec55bbdde..f1609bb44 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -10,6 +10,66 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Modify web.config files in all apps + shell: pwsh + run: | + $webConfigPaths = @( + "${{ github.workspace }}\AdminUI\LearningHub.Nhs.AdminUI\web.config", + "${{ github.workspace }}\WebAPI\LearningHub.Nhs.Api\web.config", + "${{ github.workspace }}\LearningHub.Nhs.WebUI\web.config" + ) + + foreach ($path in $webConfigPaths) { + if (Test-Path $path) { + Write-Host "Modifying $path" + [xml]$config = Get-Content $path + + if (-not $config.configuration.'system.webServer') { + $systemWebServer = $config.CreateElement("system.webServer") + $config.configuration.AppendChild($systemWebServer) | Out-Null + } else { + $systemWebServer = $config.configuration.'system.webServer' + } + + if (-not $systemWebServer.httpProtocol) { + $httpProtocol = $config.CreateElement("httpProtocol") + $systemWebServer.AppendChild($httpProtocol) | Out-Null + } else { + $httpProtocol = $systemWebServer.httpProtocol + } + + if (-not $httpProtocol.customHeaders) { + $customHeaders = $config.CreateElement("customHeaders") + $httpProtocol.AppendChild($customHeaders) | Out-Null + } else { + $customHeaders = $httpProtocol.customHeaders + } + + foreach ($name in @("X-Powered-By", "Server")) { + $removeNode = $config.CreateElement("remove") + $removeNode.SetAttribute("name", $name) + $customHeaders.AppendChild($removeNode) | Out-Null + } + + if (-not $systemWebServer.security) { + $security = $config.CreateElement("security") + $systemWebServer.AppendChild($security) | Out-Null + } else { + $security = $systemWebServer.security + } + + if (-not $security.requestFiltering) { + $requestFiltering = $config.CreateElement("requestFiltering") + $requestFiltering.SetAttribute("removeServerHeader", "true") + $security.AppendChild($requestFiltering) | Out-Null + } + + $config.Save($path) + } else { + Write-Host "File not found: $path" + } + } + - name: Setup .NET Core SDK 8.0 uses: actions/setup-dotnet@v3 with: diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Controllers/api/UserController.cs b/AdminUI/LearningHub.Nhs.AdminUI/Controllers/api/UserController.cs new file mode 100644 index 000000000..d2b97e13c --- /dev/null +++ b/AdminUI/LearningHub.Nhs.AdminUI/Controllers/api/UserController.cs @@ -0,0 +1,60 @@ +namespace LearningHub.Nhs.AdminUI.Controllers.Api +{ + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + using elfhHub.Nhs.Models.Common; + using elfhHub.Nhs.Models.Enums; + using LearningHub.Nhs.AdminUI.Interfaces; + using Microsoft.AspNetCore.Authorization; + using Microsoft.AspNetCore.Mvc; + using Microsoft.Extensions.Logging; + using Microsoft.Extensions.Options; + + /// + /// The UserController class. + /// + [Authorize] + [Route("api/[controller]")] + [ApiController] + public class UserController : BaseApiController + { + /// + /// The elfh user service.. + /// + private IUserService userService; + + /// + /// Initializes a new instance of the class. + /// + /// The userService. + /// loginWizardService. + /// logger. + /// Settings. + public UserController(IUserService userService, ILogger logger) + : base(logger) + { + this.userService = userService; + } + + /// + /// The SessionTimeout. + /// + /// The . + [HttpPost("browser-close")] + public IActionResult BrowserClose() + { + // Add browser close to the UserHistory + UserHistoryViewModel userHistory = new UserHistoryViewModel() + { + UserId = this.CurrentUserId, + UserHistoryTypeId = (int)UserHistoryType.Logout, + Detail = @"User browser closed", + }; + + this.userService.StoreUserHistory(userHistory); + + return this.Ok(true); + } + } +} diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Scripts/vuesrc/ckeditorwithhint.vue b/AdminUI/LearningHub.Nhs.AdminUI/Scripts/vuesrc/ckeditorwithhint.vue index 824b025cd..b2defb5c2 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Scripts/vuesrc/ckeditorwithhint.vue +++ b/AdminUI/LearningHub.Nhs.AdminUI/Scripts/vuesrc/ckeditorwithhint.vue @@ -1,6 +1,6 @@ diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/CatalogueOwner.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/CatalogueOwner.cshtml index faa03ac40..09709fd29 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/CatalogueOwner.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/CatalogueOwner.cshtml @@ -47,14 +47,14 @@
- +
- +
diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml index 75f4cddf2..1d8ab66da 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml @@ -137,7 +137,7 @@
- + Only the first 3,000 characters of the description will be used by search
diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Notifications/CreateEdit.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Notifications/CreateEdit.cshtml index 327cce4b8..627deb40b 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Notifications/CreateEdit.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Notifications/CreateEdit.cshtml @@ -73,7 +73,7 @@
- +
diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/Details.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/Details.cshtml index 5c7b99069..53d548c59 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/Details.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/Details.cshtml @@ -5,919 +5,922 @@ @inject IOptions webSettings @{ - ViewData["Title"] = "Details"; - var activetab = this.ViewBag.ActiveTab; + ViewData["Title"] = "Details"; + var activetab = this.ViewBag.ActiveTab; } -@section Styles{ - +@section Styles { + }
- -
-
-
- - @if (Model.ResourceVersionId == 0) - { -
Resource Version not found
- } - else - { -
-
@Model.Title (@Model.VersionStatusDescription)
-
- @if (Model.VersionStatusEnum == VersionStatusEnum.Published) - { - - } - @if (Model.VersionStatusEnum == VersionStatusEnum.Publishing || Model.VersionStatusEnum == VersionStatusEnum.FailedToPublish) - { - - } - -
-
- -