Skip to content

Commit

Permalink
PI-1833: Fixed refer and monitor roles (#3163)
Browse files Browse the repository at this point in the history
* PI-1833: Fixed refer and monitor roles

* PI-1833: Fixed pre-sentence roles
  • Loading branch information
pmcphee77 authored Feb 5, 2024
1 parent 7ccab12 commit b50e08d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PSRContextController(
private val service: PreSentenceReportService
) {

@PreAuthorize("hasAnyRole('ROLE_PSR_CONTEXT','PROBATION_API__PSR__CASE_DETAILS')")
@PreAuthorize("hasAnyRole('ROLE_PSR_CONTEXT','PROBATION_API__PSR__CONTEXT')")
@Operation(
summary = "Probation case information related to the pre-sentence report",
description = """Creating a pre-sentence report requires details of the relevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ReferralResource(
private val nsiService: NsiService,
private val appointmentService: AppointmentService
) {
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL')")
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL__RW')")
@PutMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
fun referralStarted(@PathVariable crn: String, @RequestBody referralStarted: ReferralStarted) {
Expand All @@ -30,7 +30,7 @@ class ReferralResource(
)
}

@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL')")
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL__RW')")
@PutMapping("/{referralId}/appointments")
@ResponseStatus(HttpStatus.OK)
fun mergeAppointment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ class UserResource(
private val userService: UserService,
private val auditUserRepository: AuditUserRepository
) {
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL')")
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL__RW')")
@GetMapping("managed-cases")
fun managedCases(@PathVariable username: String): ManagedCases =
managerService.findCasesManagedBy(userNameFrom(username))

@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL')")
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL__RW')")
@RequestMapping("access", method = [RequestMethod.GET, RequestMethod.POST])
fun userAccessCheck(
@PathVariable username: String,
@Size(min = 1, max = 500, message = "Please provide between 1 and 500 crns") @RequestBody crns: List<String>
): UserAccess = userService.userAccessFor(userNameFrom(username), crns)

@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL')")
@PreAuthorize("hasAnyRole('CRS_REFERRAL','PROBATION_API__REFER_AND_MONITOR__CASE_DETAIL__RW')")
@GetMapping("details")
fun userDetails(@PathVariable username: String): ResponseEntity<UserDetail> =
userService.userDetails(userNameFrom(username))?.let { ResponseEntity.ok(it) } ?: ResponseEntity.notFound()
Expand Down

0 comments on commit b50e08d

Please sign in to comment.