Skip to content

Commit b650a05

Browse files
[BTD-577] Update roles (#112)
1 parent 6c73914 commit b650a05

15 files changed

+111
-113
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/config/OpenApiConfiguration.kt

+8-10
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import io.swagger.v3.oas.models.servers.Server
88
import org.springframework.boot.info.BuildProperties
99
import org.springframework.context.annotation.Bean
1010
import org.springframework.context.annotation.Configuration
11-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Keys.KEY_LEARNERS
12-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Keys.KEY_MATCHING
1311
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLES
14-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_MATCH__RW
15-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_SEARCH__RO
12+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
13+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1614

1715
@Configuration
1816
class OpenApiConfiguration(buildProperties: BuildProperties) {
@@ -31,15 +29,15 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
3129
)
3230
.components(
3331
Components().addSecuritySchemes(
34-
KEY_LEARNERS,
35-
SecurityScheme().addBearerJwtRequirement(ROLE_LEARNER_RECORDS_SEARCH__RO),
32+
ROLE_LEARNERS_RO,
33+
SecurityScheme().addBearerJwtRequirement(ROLE_LEARNERS_RO),
3634
).addSecuritySchemes(
37-
KEY_MATCHING,
38-
SecurityScheme().addBearerJwtRequirement(ROLE_LEARNER_RECORDS_MATCH__RW),
35+
ROLE_LEARNERS_UI,
36+
SecurityScheme().addBearerJwtRequirement(ROLE_LEARNERS_UI),
3937
),
4038
)
41-
.addSecurityItem(SecurityRequirement().addList(KEY_LEARNERS, ROLES[ROLE_LEARNER_RECORDS_SEARCH__RO]))
42-
.addSecurityItem(SecurityRequirement().addList(KEY_MATCHING, ROLES[ROLE_LEARNER_RECORDS_MATCH__RW]))
39+
.addSecurityItem(SecurityRequirement().addList(ROLE_LEARNERS_RO, ROLES[ROLE_LEARNERS_RO]))
40+
.addSecurityItem(SecurityRequirement().addList(ROLE_LEARNERS_UI, ROLES[ROLE_LEARNERS_UI]))
4341
}
4442

4543
private fun SecurityScheme.addBearerJwtRequirement(role: String): SecurityScheme = type(SecurityScheme.Type.HTTP)
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package uk.gov.justice.digital.hmpps.learnerrecordsapi.config
22

3-
object Keys {
4-
5-
const val KEY_LEARNERS = "learner-records-search-read-only-role"
6-
const val KEY_MATCHING = "learner-records-search-read-write-role"
7-
}
8-
93
object Roles {
104

11-
const val ROLE_LEARNER_RECORDS_SEARCH__RO =
5+
const val ROLE_LEARNERS_RO =
126
"ROLE_LEARNER_RECORDS_SEARCH__RO"
137

14-
const val ROLE_LEARNER_RECORDS_MATCH__RW =
15-
"ROLE_LEARNER_RECORDS_MATCH__RW"
8+
const val ROLE_LEARNERS_UI =
9+
"ROLE_LEARNER_RECORDS__LEARNER_RECORDS_MATCH_UI"
1610

1711
private const val READ = "read"
1812
private const val WRITE = "write"
1913

2014
val ROLES = mapOf(
21-
ROLE_LEARNER_RECORDS_SEARCH__RO to listOf(READ),
22-
ROLE_LEARNER_RECORDS_MATCH__RW to listOf(READ, WRITE),
15+
ROLE_LEARNERS_RO to listOf(READ),
16+
ROLE_LEARNERS_UI to listOf(READ, WRITE),
2317
)
2418
}

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/openapi/LearnersApi.kt src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/openapi/FindByDemographicApi.kt

+2-9
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@ import io.swagger.v3.oas.annotations.media.Schema
99
import io.swagger.v3.oas.annotations.parameters.RequestBody
1010
import io.swagger.v3.oas.annotations.responses.ApiResponse
1111
import io.swagger.v3.oas.annotations.security.SecurityRequirement
12+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1213
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.LearnersRequest
1314
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.response.LearnersResponse
1415
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
15-
import java.nio.file.Files
16-
import java.nio.file.Paths
17-
import kotlin.text.Charsets.UTF_8
18-
19-
fun readResourceFile(fileName: String): String {
20-
val resourcePath = Paths.get("src/test/resources", fileName)
21-
return Files.readString(resourcePath, UTF_8)
22-
}
2316

2417
@Target(AnnotationTarget.FUNCTION)
2518
@Retention(AnnotationRetention.RUNTIME)
@@ -87,7 +80,7 @@ fun readResourceFile(fileName: String): String {
8780
),
8881
],
8982
),
90-
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
83+
security = [SecurityRequirement(name = ROLE_LEARNERS_UI)],
9184
responses = [
9285
ApiResponse(
9386
responseCode = "200",

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/openapi/LearnerEventsApi.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import io.swagger.v3.oas.annotations.media.Schema
99
import io.swagger.v3.oas.annotations.parameters.RequestBody
1010
import io.swagger.v3.oas.annotations.responses.ApiResponse
1111
import io.swagger.v3.oas.annotations.security.SecurityRequirement
12+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
13+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1214
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.response.LearnerEventsResponse
1315
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
1416

@@ -78,7 +80,7 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
7880
),
7981
],
8082
),
81-
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
83+
security = [SecurityRequirement(name = ROLE_LEARNERS_UI)],
8284
responses = [
8385
ApiResponse(
8486
responseCode = "200",
@@ -242,7 +244,7 @@ annotation class LearnerEventsApi
242244
),
243245
],
244246
),
245-
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
247+
security = [SecurityRequirement(name = ROLE_LEARNERS_RO)],
246248
responses = [
247249
ApiResponse(
248250
responseCode = "200",

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/openapi/MatchCheckApi.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import io.swagger.v3.oas.annotations.media.ExampleObject
1010
import io.swagger.v3.oas.annotations.media.Schema
1111
import io.swagger.v3.oas.annotations.responses.ApiResponse
1212
import io.swagger.v3.oas.annotations.security.SecurityRequirement
13+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
14+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1315
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.response.CheckMatchResponse
1416
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
1517

@@ -22,7 +24,10 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
2224
Parameter(name = "X-Username", `in` = ParameterIn.HEADER, required = true),
2325
Parameter(name = "nomisId", `in` = ParameterIn.PATH, required = true),
2426
],
25-
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
27+
security = [
28+
SecurityRequirement(name = ROLE_LEARNERS_UI),
29+
SecurityRequirement(name = ROLE_LEARNERS_RO),
30+
],
2631
responses = [
2732
ApiResponse(
2833
responseCode = "200",

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/openapi/MatchConfirmApi.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema
99
import io.swagger.v3.oas.annotations.parameters.RequestBody
1010
import io.swagger.v3.oas.annotations.responses.ApiResponse
1111
import io.swagger.v3.oas.annotations.security.SecurityRequirement
12+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1213
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.ConfirmMatchRequest
1314
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
1415

@@ -41,7 +42,7 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
4142
),
4243
],
4344
),
44-
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
45+
security = [SecurityRequirement(name = ROLE_LEARNERS_UI)],
4546
responses = [
4647
ApiResponse(
4748
responseCode = "201",

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/resource/LearnerEventsResource.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RequestHeader
1111
import org.springframework.web.bind.annotation.RequestMapping
1212
import org.springframework.web.bind.annotation.RestController
1313
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.AuditEvent.createAuditEvent
14-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_SEARCH__RO
14+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
15+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1516
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil
1617
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil.log
1718
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.lrsapi.response.exceptions.MatchNotFoundException
@@ -24,7 +25,6 @@ import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.LearnerEventsServi
2425
import uk.gov.justice.hmpps.sqs.audit.HmppsAuditService
2526

2627
@RestController
27-
@PreAuthorize("hasRole('$ROLE_LEARNER_RECORDS_SEARCH__RO')")
2828
class LearnerEventsResource(
2929
private val learnerEventsService: LearnerEventsService,
3030
private val auditService: HmppsAuditService,
@@ -34,6 +34,7 @@ class LearnerEventsResource(
3434
val searchLearnerEventsByULN = "SEARCH_LEARNER_EVENTS_BY_ULN"
3535
val searchLearnerEventsByNomisId = "SEARCH_LEARNER_EVENTS_BY_NOMISID"
3636

37+
@PreAuthorize("hasRole('$ROLE_LEARNERS_UI')")
3738
@RequestMapping(value = ["/learner-events"], produces = ["application/json"])
3839
@Tag(name = "Learning Events")
3940
@LearnerEventsApi
@@ -47,6 +48,7 @@ class LearnerEventsResource(
4748
return ResponseEntity.status(HttpStatus.OK).body(learnerEventsResponse)
4849
}
4950

51+
@PreAuthorize("hasRole('$ROLE_LEARNERS_RO')")
5052
@RequestMapping(value = ["/learner-events/nomisId"], produces = ["application/json"])
5153
@Tag(name = "Learning Events By Nomis ID")
5254
@LearnerEventsByNomisIdApi

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/resource/LearnersResource.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestHeader
1111
import org.springframework.web.bind.annotation.RequestMapping
1212
import org.springframework.web.bind.annotation.RestController
1313
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.AuditEvent.createAuditEvent
14-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_SEARCH__RO
14+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1515
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil
1616
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil.log
1717
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.LearnersRequest
@@ -21,7 +21,7 @@ import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.LearnersService
2121
import uk.gov.justice.hmpps.sqs.audit.HmppsAuditService
2222

2323
@RestController
24-
@PreAuthorize("hasRole('$ROLE_LEARNER_RECORDS_SEARCH__RO')")
24+
@PreAuthorize("hasRole('$ROLE_LEARNERS_UI')")
2525
@RequestMapping(value = ["/learners"], produces = ["application/json"])
2626
class LearnersResource(
2727
private val learnersService: LearnersService,

src/main/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/resource/MatchResource.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody
1212
import org.springframework.web.bind.annotation.RequestHeader
1313
import org.springframework.web.bind.annotation.RequestMapping
1414
import org.springframework.web.bind.annotation.RestController
15-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_MATCH__RW
15+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
16+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_UI
1617
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil
1718
import uk.gov.justice.digital.hmpps.learnerrecordsapi.logging.LoggerUtil.log
1819
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.ConfirmMatchRequest
@@ -23,7 +24,6 @@ import uk.gov.justice.digital.hmpps.learnerrecordsapi.openapi.MatchConfirmApi
2324
import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.MatchService
2425
import java.net.URI
2526

26-
@PreAuthorize("hasRole('$ROLE_LEARNER_RECORDS_MATCH__RW')")
2727
@RestController
2828
@RequestMapping(value = ["/match"], produces = ["application/json"])
2929
class MatchResource(
@@ -32,6 +32,7 @@ class MatchResource(
3232

3333
val logger = LoggerUtil.getLogger<MatchResource>()
3434

35+
@PreAuthorize("hasAnyRole('$ROLE_LEARNERS_UI', '$ROLE_LEARNERS_RO')")
3536
@GetMapping("/{nomisId}")
3637
@Tag(name = "Match")
3738
@MatchCheckApi
@@ -51,6 +52,7 @@ class MatchResource(
5152
)
5253
}
5354

55+
@PreAuthorize("hasRole('$ROLE_LEARNERS_UI')")
5456
@PostMapping(value = ["/{nomisId}"])
5557
@Tag(name = "Match")
5658
@MatchConfirmApi

src/test/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/config/HmppsBoldLrsExceptionHandlerTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.BeforeEach
66
import org.junit.jupiter.api.Test
77
import org.springframework.beans.factory.annotation.Autowired
88
import org.springframework.http.HttpStatus
9-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_SEARCH__RO
9+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
1010
import uk.gov.justice.digital.hmpps.learnerrecordsapi.integration.IntegrationTestBase
1111
import java.time.Duration
1212

@@ -33,7 +33,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {
3333
val actualResponse = objectMapper.readValue(
3434
webTestClient.post()
3535
.uri(uri)
36-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
36+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
3737
.exchange()
3838
.expectStatus()
3939
.isEqualTo(expectedStatus)
@@ -137,7 +137,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {
137137
val actualResponse = objectMapper.readValue(
138138
webTestClient.post()
139139
.uri("/test/okhttp-timeout")
140-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
140+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
141141
.exchange()
142142
.expectStatus()
143143
.isEqualTo(HttpStatus.REQUEST_TIMEOUT)

src/test/kotlin/uk/gov/justice/digital/hmpps/learnerrecordsapi/config/ValidationTest.kt

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test
66
import org.springframework.beans.factory.annotation.Autowired
77
import org.springframework.http.HttpStatus
88
import org.springframework.http.MediaType
9-
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNER_RECORDS_SEARCH__RO
9+
import uk.gov.justice.digital.hmpps.learnerrecordsapi.config.Roles.ROLE_LEARNERS_RO
1010
import uk.gov.justice.digital.hmpps.learnerrecordsapi.integration.IntegrationTestBase
1111
import uk.gov.justice.digital.hmpps.learnerrecordsapi.models.request.Gender
1212

@@ -43,7 +43,7 @@ class ValidationTest : IntegrationTestBase() {
4343
val actualResponse = objectMapper.readValue(
4444
webTestClient.post()
4545
.uri("/learners")
46-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
46+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
4747
.header("X-Username", "TestUser")
4848
.bodyValue(findLearnerByDemographicsRequest)
4949
.accept(MediaType.parseMediaType("application/json"))
@@ -85,7 +85,7 @@ class ValidationTest : IntegrationTestBase() {
8585
val actualResponse = objectMapper.readValue(
8686
webTestClient.post()
8787
.uri("/learners")
88-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
88+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
8989
.header("X-Username", "TestUser")
9090
.bodyValue(findLearnerByDemographicsRequest)
9191
.accept(MediaType.parseMediaType("application/json"))
@@ -123,7 +123,7 @@ class ValidationTest : IntegrationTestBase() {
123123
val actualResponse = objectMapper.readValue(
124124
webTestClient.post()
125125
.uri("/learner-events")
126-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
126+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
127127
.header("X-Username", "TestUser")
128128
.bodyValue(learnerEventsRequest)
129129
.accept(MediaType.parseMediaType("application/json"))
@@ -164,7 +164,7 @@ class ValidationTest : IntegrationTestBase() {
164164
val actualResponse = objectMapper.readValue(
165165
webTestClient.post()
166166
.uri("/learners")
167-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
167+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
168168
.header("X-Username", "TestUser")
169169
.bodyValue(findLearnerByDemographicsRequest)
170170
.accept(MediaType.parseMediaType("application/json"))
@@ -205,7 +205,7 @@ class ValidationTest : IntegrationTestBase() {
205205
val actualResponse = objectMapper.readValue(
206206
webTestClient.post()
207207
.uri("/learners")
208-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
208+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
209209
.header("X-Username", "TestUser")
210210
.bodyValue(findLearnerByDemographicsRequest)
211211
.accept(MediaType.parseMediaType("application/json"))
@@ -246,7 +246,7 @@ class ValidationTest : IntegrationTestBase() {
246246
val actualResponse = objectMapper.readValue(
247247
webTestClient.post()
248248
.uri("/learners")
249-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
249+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
250250
.header("X-Username", "TestUser")
251251
.bodyValue(findLearnerByDemographicsRequest)
252252
.accept(MediaType.parseMediaType("application/json"))
@@ -283,7 +283,7 @@ class ValidationTest : IntegrationTestBase() {
283283
val actualResponse = objectMapper.readValue(
284284
webTestClient.post()
285285
.uri("/learner-events")
286-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
286+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
287287
.header("X-Username", "TestUser")
288288
.bodyValue(learnerEventsRequest)
289289
.accept(MediaType.parseMediaType("application/json"))
@@ -320,7 +320,7 @@ class ValidationTest : IntegrationTestBase() {
320320
val actualResponse = objectMapper.readValue(
321321
webTestClient.post()
322322
.uri("/learner-events")
323-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
323+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
324324
.header("X-Username", "TestUser")
325325
.bodyValue(learnerEventsRequest)
326326
.accept(MediaType.parseMediaType("application/json"))
@@ -357,7 +357,7 @@ class ValidationTest : IntegrationTestBase() {
357357
val actualResponse = objectMapper.readValue(
358358
webTestClient.post()
359359
.uri("/learners")
360-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
360+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
361361
.header("X-Username", "TestUser")
362362
.contentType(MediaType.APPLICATION_JSON)
363363
.bodyValue(findLearnerByDemographicsRequest)
@@ -394,7 +394,7 @@ class ValidationTest : IntegrationTestBase() {
394394
val actualResponse = objectMapper.readValue(
395395
webTestClient.post()
396396
.uri("/learner-events")
397-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
397+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
398398
.header("X-Username", "TestUser").contentType(MediaType.APPLICATION_JSON)
399399
.bodyValue(findLearnerByDemographicsRequest)
400400
.exchange()
@@ -434,7 +434,7 @@ class ValidationTest : IntegrationTestBase() {
434434
val actualResponse = objectMapper.readValue(
435435
webTestClient.post()
436436
.uri("/learners")
437-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
437+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
438438
.header("X-Username", "TestUser")
439439
.contentType(MediaType.APPLICATION_JSON)
440440
.bodyValue(requestJsonWithoutGivenName)
@@ -476,7 +476,7 @@ class ValidationTest : IntegrationTestBase() {
476476
val actualResponse = objectMapper.readValue(
477477
webTestClient.post()
478478
.uri("/learner-events")
479-
.headers(setAuthorisation(roles = listOf(ROLE_LEARNER_RECORDS_SEARCH__RO)))
479+
.headers(setAuthorisation(roles = listOf(ROLE_LEARNERS_RO)))
480480
.header("X-Username", "TestUser")
481481
.contentType(MediaType.APPLICATION_JSON)
482482
.bodyValue(requestJsonWithoutGivenName)

0 commit comments

Comments
 (0)