Skip to content

Commit

Permalink
Merge pull request #2256 from ministryofjustice/feature/aps-1713-fix-…
Browse files Browse the repository at this point in the history
…incorrect-oosb-permission-usage

APS-1713 - Remove incorrect use of out of service bed permission
  • Loading branch information
davidatkinsuk authored Dec 18, 2024
2 parents b2dd751 + ae4a0e4 commit 8021870
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integration_tests/tests/manage/future_manager/beds.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ context('Beds', () => {

it('should allow me to visit a bed from the bed list page', () => {
// Given I am signed in as a workflow manager
signIn(['future_manager'])
signIn(['future_manager'], ['cas1_premises_view'])

// When I visit the beds page
const bedsPage = BedsListPage.visit(premisesId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ context('OutOfServiceBeds', () => {
cy.task('stubBed', { premisesId: premises.id, bedDetail })

// Given I am signed in with permissions to view and create out of service beds
signIn([], ['cas1_out_of_service_bed_create', 'cas1_view_out_of_service_beds'])
signIn([], ['cas1_premises_view', 'cas1_out_of_service_bed_create', 'cas1_view_out_of_service_beds'])

// When I navigate to the out of service bed form
const page = OutOfServiceBedCreatePage.visit(premises.id, outOfServiceBed.bed.id)
Expand Down
5 changes: 2 additions & 3 deletions server/routes/manage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ describe('manage routes', () => {
const postSpy = jest.fn()
;(actions as jest.Mock).mockReturnValue({ get: getSpy, post: postSpy, put: jest.fn(), delete: jest.fn() })

it('should allow a user with role cru_member to view a bed', () => {
it('should allow a user with permission cas1_premises_view to view a bed', () => {
manageRoutes(controllers, router, services)

expect(getSpy).toHaveBeenCalledWith(paths.premises.beds.show.pattern, bedsController.show(), {
auditEvent: 'SHOW_BED',
allowedRoles: ['future_manager', 'cru_member'],
allowedPermissions: ['cas1_out_of_service_bed_create'],
allowedPermissions: ['cas1_premises_view'],
})
})

Expand Down
3 changes: 1 addition & 2 deletions server/routes/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ export default function routes(controllers: Controllers, router: Router, service
})
get(paths.premises.beds.show.pattern, bedsController.show(), {
auditEvent: 'SHOW_BED',
allowedRoles: ['future_manager', 'cru_member'],
allowedPermissions: ['cas1_out_of_service_bed_create'],
allowedPermissions: ['cas1_premises_view'],
})

// Placements
Expand Down

0 comments on commit 8021870

Please sign in to comment.