Skip to content

Commit c305436

Browse files
author
Daniel Liburd
committed
Update roles for viewing dashboard items
We now have CAS2 Bail specific user roles so they should be used to display the correct tiles on the dashboard.
1 parent df5c9e2 commit c305436

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

server/utils/userUtils.test.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ describe('userUtils', () => {
66
expect(sectionsForUser([])).toEqual([])
77
})
88

9-
it('should return correct sections for a POM', () => {
9+
it('should return correct sections for a CAS2 prison bail referrer', () => {
1010
const expected = [sections.applications, sections.newApplication]
11-
expect(sectionsForUser(['POM'])).toEqual(expected)
11+
expect(sectionsForUser(['CAS2_PRISON_BAIL_REFERRER'])).toEqual(expected)
1212
})
1313

14-
it('should return correct sections for a Licence CA', () => {
14+
it('should return correct sections for a CAS2 court bail referrer', () => {
1515
const expected = [sections.applications, sections.newApplication]
16-
expect(sectionsForUser(['LICENCE_CA'])).toEqual(expected)
17-
})
18-
19-
it('should return correct sections for a probation user', () => {
20-
const expected = [sections.applications, sections.newApplication]
21-
expect(sectionsForUser(['PROBATION'])).toEqual(expected)
16+
expect(sectionsForUser(['CAS2_COURT_BAIL_REFERRER'])).toEqual(expected)
2217
})
2318

2419
it('should return correct sections for an admin', () => {

server/utils/userUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const hasRole = (userRoles: Array<string>, role: string): boolean => {
4343
export const sectionsForUser = (userRoles: Array<string>): Array<ServiceSection> => {
4444
const items = []
4545

46-
if (hasRole(userRoles, 'POM') || hasRole(userRoles, 'LICENCE_CA') || hasRole(userRoles, 'PROBATION')) {
46+
if (hasRole(userRoles, 'CAS2_PRISON_BAIL_REFERRER') || hasRole(userRoles, 'CAS2_COURT_BAIL_REFERRER')) {
4747
items.push(sections.applications)
4848
items.push(sections.newApplication)
4949
}

0 commit comments

Comments
 (0)