Skip to content

Commit 72d5550

Browse files
authored
Merge pull request #1334 from TechnologyEnhancedLearning/RC
Merge RC changes to CI
2 parents d088e34 + 70ebf90 commit 72d5550

File tree

11 files changed

+36
-28
lines changed

11 files changed

+36
-28
lines changed

LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeLocationTab.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,15 @@
8585
return new CatalogueModel({ nodeId: 0 });
8686
},
8787
resourceDescription(): string {
88-
return this.resourceDetails.description;
88+
return this.resourceDetails.description;
8989
},
9090
isDividerVisible(): boolean {
9191
return this.resourceDetails.resourceCatalogueId >= 0 && this.selectionInProgress;
9292
},
9393
allowCatalogueChange(): boolean {
94-
return (!Boolean(this.$route.query.initialCreate)); // allow if user is contributing into the catalogue root // or if the user is editing an existing draft (initialCreate=false)
95-
//this.resourceDetails.resourceCatalogueId === this.resourceDetails.nodeId) ||
94+
return (this.resourceDetails.resourceCatalogueId === this.resourceDetails.nodeId) || // allow if user is contributing into the catalogue root
95+
!Boolean(this.$route.query.initialCreate);
96+
// allow if user is contributing into the catalogue root // or if the user is editing an existing draft (initialCreate=false)
9697
},
9798
onChangeClick() {
9899
this.$emit('change-click');

LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
</div>
244244
</div>
245245

246-
<catalogue-select v-if="resourceCatalogueCount>1 && showCatalogueSelect" v-model.number="resourceCatalogueId" @input="catalogueSelected"></catalogue-select>
246+
<catalogue-select v-if="resourceCatalogueCount>0 && showCatalogueSelect" v-model.number="resourceCatalogueId" @input="catalogueSelected"></catalogue-select>
247247
</div>
248248
</template>
249249

@@ -314,11 +314,11 @@
314314
return this.$store.state.userProviders;
315315
},
316316
resourceCatalogueCount(): number {
317-
if (!this.$store.state.userCatalogues) {
317+
if (!this.$store.state.userCatalogues) {
318318
return 0;
319319
} else {
320320
return this.$store.state.userCatalogues.length;
321-
}
321+
}
322322
},
323323
userIsAuthor(): boolean {
324324
return this.authors.filter(a => a.isContributor).length > 0;
@@ -333,9 +333,8 @@
333333
return this.$store.state.resourceDetail.resourceType;
334334
},
335335
showCatalogueSelect(): boolean {
336-
//return (this.resourceDetail.resourceCatalogueId === this.resourceDetail.nodeId) || // show if user is contributing into the catalogue root
337-
// !Boolean(this.$route.query.initialCreate); // or if the user is editing an existing draft (initialCreate=false)
338-
return (!Boolean(this.$route.query.initialCreate));
336+
return (this.resourceDetail.resourceCatalogueId === this.resourceDetail.nodeId) || // show if user is contributing into the catalogue root
337+
!Boolean(this.$route.query.initialCreate); // or if the user is editing an existing draft (initialCreate=false)
339338
},
340339
newKeywordTrimmed(): string {
341340
return this.newKeyword?.trim().replace(/ +(?= )/g, '');

LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ button[data-toggle="modal"] {
5353
}
5454

5555
.autosuggestion-menu {
56-
padding: 16px 16px 0px 16px;
56+
padding: 16px 16px 0px 16px !important;
5757
background-color: $color_nhsuk-white;
5858
border-bottom: 1px solid $color_nhsuk-grey-4;
5959
border-radius: 0px 0px 4px 4px;

LearningHub.Nhs.WebUI/Views/Catalogue/Index.cshtml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99
ViewData["Title"] = "Catalogue";
1010

1111

12-
bool CanManage()
13-
{
14-
return IsInRole(RoleEnum.LocalAdmin);
15-
}
12+
bool CanManage()
13+
{
14+
return IsInRole(RoleEnum.LocalAdmin);
15+
}
1616

17-
bool Unlocked()
18-
{
19-
return IsInRole(RoleEnum.LocalAdmin) || IsInRole(RoleEnum.Editor) || IsInRole(RoleEnum.Reader) ;
20-
//// || this.User.IsInRole("Administrator")
21-
}
17+
bool Unlocked()
18+
{
19+
return IsInRole(RoleEnum.LocalAdmin) || IsInRole(RoleEnum.Editor) || IsInRole(RoleEnum.Reader) || this.User.IsInRole("Administrator");
20+
}
2221

2322
bool IsInRole(RoleEnum role)
2423
{

OpenAPI/LearningHub.Nhs.OpenApi/Controllers/BookmarkController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
using System.Threading.Tasks;
55
using LearningHub.Nhs.Models.Bookmark;
66
using LearningHub.Nhs.OpenApi.Services.Interface.Services;
7+
using Microsoft.AspNetCore.Authorization;
78
using Microsoft.AspNetCore.Mvc;
89

910
/// <summary>
1011
/// Learning Hub Bookmark controller.
1112
/// </summary>
1213
[Route("Bookmark")]
1314
[ApiController]
15+
[Authorize]
1416
public class BookmarkController : OpenApiControllerBase
1517
{
1618
private readonly IBookmarkService bookmarkService;

OpenAPI/LearningHub.Nhs.OpenApi/Controllers/CatalogueController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// </summary>
1515
[Route("Catalogue")]
1616
[Authorize]
17+
[ApiController]
1718
public class CatalogueController : OpenApiControllerBase
1819
{
1920
private readonly ICatalogueService catalogueService;

OpenAPI/LearningHub.Nhs.OpenApi/Controllers/ResourceController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace LearningHub.NHS.OpenAPI.Controllers
2929
/// </summary>
3030
[Route("Resource")]
3131
[Authorize]
32+
[ApiController]
3233
public class ResourceController : OpenApiControllerBase
3334
{
3435
private const int MaxNumberOfReferenceIds = 1000;

OpenAPI/LearningHub.Nhs.OpenApi/Controllers/SearchController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
using LearningHub.Nhs.OpenApi.Models.Configuration;
1212
using LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories;
1313
using LearningHub.Nhs.OpenApi.Services.Interface.Services;
14+
using Microsoft.AspNetCore.Authorization;
1415
using Microsoft.AspNetCore.Mvc;
1516
using Microsoft.Extensions.Logging;
1617
using Microsoft.Extensions.Options;
1718

1819
/// <summary>
1920
/// Search operations.
2021
/// </summary>
22+
[Authorize]
2123
[Route("Search")]
2224
[ApiController]
2325
public class SearchController : OpenApiControllerBase

OpenAPI/LearningHub.Nhs.OpenApi/Startup.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,29 @@ namespace LearningHub.NHS.OpenAPI
88
using System.Collections.Generic;
99
using System.IO;
1010
using AspNetCore.Authentication.ApiKey;
11+
using LearningHub.Nhs.Api.Authentication;
1112
using LearningHub.Nhs.Caching;
1213
using LearningHub.Nhs.Models.Enums;
1314
using LearningHub.Nhs.Models.Extensions;
1415
using LearningHub.NHS.OpenAPI.Auth;
16+
using LearningHub.NHS.OpenAPI.Authentication;
1517
using LearningHub.NHS.OpenAPI.Configuration;
1618
using LearningHub.NHS.OpenAPI.Middleware;
1719
using LearningHub.Nhs.OpenApi.Repositories;
1820
using LearningHub.Nhs.OpenApi.Repositories.EntityFramework;
1921
using LearningHub.Nhs.OpenApi.Services;
2022
using Microsoft.AspNetCore.Authentication;
2123
using Microsoft.AspNetCore.Authentication.JwtBearer;
24+
using Microsoft.AspNetCore.Authorization;
2225
using Microsoft.AspNetCore.Builder;
2326
using Microsoft.AspNetCore.Hosting;
24-
using Microsoft.AspNetCore.Mvc.Authorization;
2527
using Microsoft.EntityFrameworkCore;
2628
using Microsoft.Extensions.Configuration;
2729
using Microsoft.Extensions.DependencyInjection;
2830
using Microsoft.Extensions.FileProviders;
2931
using Microsoft.Extensions.Hosting;
3032
using Microsoft.IdentityModel.Tokens;
3133
using Microsoft.OpenApi.Models;
32-
using Microsoft.AspNetCore.Authorization;
33-
using LearningHub.NHS.OpenAPI.Authentication;
34-
using LearningHub.Nhs.Api.Authentication;
3534

3635
/// <summary>
3736
/// The Startup class.
@@ -62,8 +61,12 @@ public void ConfigureServices(IServiceCollection services)
6261

6362
services.AddApiKeyAuth();
6463

65-
services.AddAuthentication()
66-
.AddJwtBearer(options =>
64+
services.AddAuthentication(options =>
65+
{
66+
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
67+
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
68+
})
69+
.AddJwtBearer(options =>
6770
{
6871
options.Authority = this.Configuration.GetValue<string>("LearningHUbAuthServiceConfig:Authority");
6972
options.TokenValidationParameters = new TokenValidationParameters()
@@ -76,7 +79,7 @@ public void ConfigureServices(IServiceCollection services)
7679
});
7780

7881
services.AddCustomMiddleware();
79-
services.AddSingleton<IAuthorizationHandler, ReadWriteHandler>();
82+
services.AddSingleton<IAuthorizationHandler, ReadWriteHandler>();
8083
services.AddSingleton<IAuthorizationHandler, AuthorizeOrCallFromLHHandler>();
8184

8285
services.AddRepositories(this.Configuration);
@@ -89,7 +92,6 @@ public void ConfigureServices(IServiceCollection services)
8992
services.AddControllers(options =>
9093
{
9194
options.Filters.Add(new HttpResponseExceptionFilter());
92-
options.Filters.Add(new AuthorizeFilter());
9395
});
9496

9597
services.AddMvc()

OpenAPI/LearningHub.Nhs.OpenApi/appsettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"UseRedisCache": true,
7979
"ResourcePublishQueueRouteName": "",
8080
"HierarchyEditPublishQueueName": "",
81+
"ContentManagementQueueName": "",
8182
"AuthClientIdentityKey": "",
8283
"LHClientIdentityKey": "",
8384
"ReportApiClientIdentityKey": "",

0 commit comments

Comments
 (0)