Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ obj
/AdminUI/LearningHub.Nhs.AdminUI/web.config
/LearningHub.Nhs.WebUI/web.config
/WebAPI/LearningHub.Nhs.API/web.config
/nuget.config
/LearningHub.Nhs.WebUI.slnLaunch.user
/LearningHub.Nhs.WebUI.BlazorClient/LearningHub.Nhs.WebUI.BlazorClient.csproj.user
/LearningHub.Nhs.WebUI.BlazorClient/wwwroot/appsettings.Development.json
/LearningHub.Nhs.WebUI.BlazorClient/Properties/launchSettings.json
/LearningHub.Nhs.WebUI/nuget.config
/LearningHub.Nhs.WebUI.BlazorClient/Properties/launchSettings.json
/LearningHub.Nhs.WebUI.BlazorClient/wwwroot/appsettings.json
/LearningHub.Nhs.WebUI.BlazorClient/wwwroot/appsettings.Development.json
/LearningHub.Nhs.WebUI.BlazorClient/nuget.config
/LearningHub.Nhs.WebUI.BlazorClient/LearningHub.Nhs.WebUI.BlazorClient.csproj.user
/nuget.config
/LearningHub.Nhs.WebUI.slnLaunch.user
/.github/workflows/test.yml
2 changes: 1 addition & 1 deletion LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ button[data-toggle="modal"] {
}

.autosuggestion-menu {
padding: 16px 16px 0px 16px;
padding: 16px 16px 0px 16px !important;
background-color: $color_nhsuk-white;
border-bottom: 1px solid $color_nhsuk-grey-4;
border-radius: 0px 0px 4px 4px;
Expand Down
17 changes: 8 additions & 9 deletions LearningHub.Nhs.WebUI/Views/Catalogue/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
ViewData["Title"] = "Catalogue";


bool CanManage()
{
return IsInRole(RoleEnum.LocalAdmin);
}
bool CanManage()
{
return IsInRole(RoleEnum.LocalAdmin);
}

bool Unlocked()
{
return IsInRole(RoleEnum.LocalAdmin) || IsInRole(RoleEnum.Editor) || IsInRole(RoleEnum.Reader) ;
//// || this.User.IsInRole("Administrator")
}
bool Unlocked()
{
return IsInRole(RoleEnum.LocalAdmin) || IsInRole(RoleEnum.Editor) || IsInRole(RoleEnum.Reader) || this.User.IsInRole("Administrator");
}

bool IsInRole(RoleEnum role)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using System.Threading.Tasks;
using LearningHub.Nhs.Models.Bookmark;
using LearningHub.Nhs.OpenApi.Services.Interface.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

/// <summary>
/// Learning Hub Bookmark controller.
/// </summary>
[Route("Bookmark")]
[ApiController]
[Authorize]
public class BookmarkController : OpenApiControllerBase
{
private readonly IBookmarkService bookmarkService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/// </summary>
[Route("Catalogue")]
[Authorize]
[ApiController]
public class CatalogueController : OpenApiControllerBase
{
private readonly ICatalogueService catalogueService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace LearningHub.NHS.OpenAPI.Controllers
/// </summary>
[Route("Resource")]
[Authorize]
[ApiController]
public class ResourceController : OpenApiControllerBase
{
private const int MaxNumberOfReferenceIds = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
using LearningHub.Nhs.OpenApi.Models.Configuration;
using LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories;
using LearningHub.Nhs.OpenApi.Services.Interface.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

/// <summary>
/// Search operations.
/// </summary>
[Authorize]
[Route("Search")]
[ApiController]
public class SearchController : OpenApiControllerBase
Expand Down
18 changes: 10 additions & 8 deletions OpenAPI/LearningHub.Nhs.OpenApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,29 @@ namespace LearningHub.NHS.OpenAPI
using System.Collections.Generic;
using System.IO;
using AspNetCore.Authentication.ApiKey;
using LearningHub.Nhs.Api.Authentication;
using LearningHub.Nhs.Caching;
using LearningHub.Nhs.Models.Enums;
using LearningHub.Nhs.Models.Extensions;
using LearningHub.NHS.OpenAPI.Auth;
using LearningHub.NHS.OpenAPI.Authentication;
using LearningHub.NHS.OpenAPI.Configuration;
using LearningHub.NHS.OpenAPI.Middleware;
using LearningHub.Nhs.OpenApi.Repositories;
using LearningHub.Nhs.OpenApi.Repositories.EntityFramework;
using LearningHub.Nhs.OpenApi.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.Authorization;
using LearningHub.NHS.OpenAPI.Authentication;
using LearningHub.Nhs.Api.Authentication;

/// <summary>
/// The Startup class.
Expand Down Expand Up @@ -62,8 +61,12 @@ public void ConfigureServices(IServiceCollection services)

services.AddApiKeyAuth();

services.AddAuthentication()
.AddJwtBearer(options =>
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.Authority = this.Configuration.GetValue<string>("LearningHUbAuthServiceConfig:Authority");
options.TokenValidationParameters = new TokenValidationParameters()
Expand All @@ -76,7 +79,7 @@ public void ConfigureServices(IServiceCollection services)
});

services.AddCustomMiddleware();
services.AddSingleton<IAuthorizationHandler, ReadWriteHandler>();
services.AddSingleton<IAuthorizationHandler, ReadWriteHandler>();
services.AddSingleton<IAuthorizationHandler, AuthorizeOrCallFromLHHandler>();

services.AddRepositories(this.Configuration);
Expand All @@ -89,7 +92,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddControllers(options =>
{
options.Filters.Add(new HttpResponseExceptionFilter());
options.Filters.Add(new AuthorizeFilter());
});

services.AddMvc()
Expand Down
1 change: 1 addition & 0 deletions OpenAPI/LearningHub.Nhs.OpenApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"UseRedisCache": true,
"ResourcePublishQueueRouteName": "",
"HierarchyEditPublishQueueName": "",
"ContentManagementQueueName": "",
"AuthClientIdentityKey": "",
"LHClientIdentityKey": "",
"ReportApiClientIdentityKey": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ BEGIN
,cnv.CardImageUrl
,cnv.Url
,cnv.RestrictedAccess
,CAST(CASE WHEN cnv.RestrictedAccess = 1 THEN 0 ELSE 1 END AS bit) AS HasAccess
,CAST(CASE WHEN cnv.RestrictedAccess = 1 AND auth.CatalogueNodeId IS NULL THEN 0 ELSE 1 END AS bit) AS HasAccess
,ub.Id AS BookMarkId
,CAST(ISNULL(ub.[Deleted], 1) ^ 1 AS BIT) AS IsBookmarked
FROM @MyActivity ma
Expand Down
14 changes: 12 additions & 2 deletions nuget.config.cicd
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,21 @@
<packageSourceMapping>
<packageSource key="TELGitNugetFeed">
<package pattern="TELBlazor.*" />
<package pattern="*" />
<package pattern="NHSETELViewComponents" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<packageSource key="TELAzureLearningHubNugetFeed">
<package pattern="LearningHub.*" />
<package pattern="LearningHub.Nhs.*" />
<package pattern="elfhHub.Nhs.*" />
<package pattern="GDS.MultiPageFormData" />
<package pattern="NHSUKSearchSortFilterPaginate" />
<package pattern="NHSUKViewComponents.Web" />
<package pattern="UK.NHS.CookieBanner*" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->

</packageSource>

<!--Check official nuget last-->
Expand Down
13 changes: 11 additions & 2 deletions nuget.config.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
<packageSourceMapping>
<packageSource key="TELGitNugetFeed">
<package pattern="TELBlazor.*" />
<package pattern="*" />
<package pattern="NHSETELViewComponents" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<packageSource key="TELAzureLearningHubNugetFeed">
<package pattern="LearningHub.*" />
<package pattern="LearningHub.Nhs.*" />
<package pattern="elfhHub.Nhs.*" />
<package pattern="GDS.MultiPageFormData" />
<package pattern="NHSUKSearchSortFilterPaginate" />
<package pattern="NHSUKViewComponents.Web" />
<package pattern="UK.NHS.CookieBanner*" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<!--Check official nuget last-->
Expand Down
Loading