diff --git a/packages/client/src/components/interface/Navigation.test.tsx b/packages/client/src/components/interface/Navigation.test.tsx index 4722f14142..969d8c10c0 100644 --- a/packages/client/src/components/interface/Navigation.test.tsx +++ b/packages/client/src/components/interface/Navigation.test.tsx @@ -302,7 +302,10 @@ describe('Given a user with scopes views Navigation', () => { describe('Sent for approval', async () => { const id = `#navigation_${WORKQUEUE_TABS.sentForApproval}` - const requiredScopes = [SCOPES.RECORD_SUBMIT_FOR_APPROVAL] as Scope[] + const requiredScopes = [ + SCOPES.RECORD_SUBMIT_FOR_APPROVAL, + SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION + ] as Scope[] const allOtherScopes = allScopes.filter( (scope) => !requiredScopes.includes(scope) @@ -447,12 +450,8 @@ describe('Given a user with scopes views Navigation', () => { const id = `#navigation_${WORKQUEUE_TABS.outbox}` const requiredScopes = [ - SCOPES.RECORD_DECLARE_BIRTH, - SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION, - SCOPES.RECORD_DECLARE_DEATH, - SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION, - SCOPES.RECORD_DECLARE_MARRIAGE, - SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, SCOPES.RECORD_SUBMIT_FOR_APPROVAL, SCOPES.RECORD_SUBMIT_FOR_UPDATES, SCOPES.RECORD_REVIEW_DUPLICATES, diff --git a/packages/client/src/hooks/useAuthorization.ts b/packages/client/src/hooks/useAuthorization.ts index e2f6b1045d..e81c605dbc 100644 --- a/packages/client/src/hooks/useAuthorization.ts +++ b/packages/client/src/hooks/useAuthorization.ts @@ -31,10 +31,7 @@ export const RECORD_ALLOWED_SCOPES = { UPDATE: [ SCOPES.RECORD_REGISTER, SCOPES.RECORD_SUBMIT_FOR_UPDATES, - SCOPES.RECORD_SUBMIT_FOR_APPROVAL, - SCOPES.RECORD_DECLARE_BIRTH, - SCOPES.RECORD_DECLARE_DEATH, - SCOPES.RECORD_DECLARE_MARRIAGE + SCOPES.RECORD_SUBMIT_FOR_APPROVAL ], REVIEW: [ SCOPES.RECORD_REGISTER, diff --git a/packages/client/src/hooks/useNavigation.ts b/packages/client/src/hooks/useNavigation.ts index 7da6ce9f50..00260a3207 100644 --- a/packages/client/src/hooks/useNavigation.ts +++ b/packages/client/src/hooks/useNavigation.ts @@ -88,6 +88,8 @@ const routeAccess: NavigationConfig[] = [ { name: WORKQUEUE_TABS.outbox, scopes: [ + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, SCOPES.RECORD_SUBMIT_FOR_APPROVAL, SCOPES.RECORD_SUBMIT_FOR_UPDATES, SCOPES.RECORD_REVIEW_DUPLICATES, diff --git a/packages/client/src/user/userReducer.ts b/packages/client/src/user/userReducer.ts index d3e8a8edab..7eac7c4864 100644 --- a/packages/client/src/user/userReducer.ts +++ b/packages/client/src/user/userReducer.ts @@ -392,6 +392,16 @@ export const userFormReducer: LoopReducer = ( const roleScopes = (role: string) => userRoles.find(({ id }) => id === role)?.scopes ?? [] + const canCreateOrUpdateAll = [ + SCOPES.USER_CREATE, + SCOPES.USER_UPDATE + ].some((scope) => loggedInUserScopes.includes(scope)) + + const canCreateOrUpdateJurisdiction = [ + SCOPES.USER_CREATE_MY_JURISDICTION, + SCOPES.USER_UPDATE_MY_JURISDICTION + ].some((scope) => loggedInUserScopes.includes(scope)) + const form = deserializeForm(getCreateUserForm(), validators) const modifiedForm = modifyFormField( @@ -406,11 +416,13 @@ export const userFormReducer: LoopReducer = ( options: userRoles .filter( ({ id }) => - loggedInUserScopes.includes(SCOPES.USER_CREATE) || - (loggedInUserScopes.includes( - SCOPES.USER_CREATE_MY_JURISDICTION - ) && - !roleScopes(id).includes(SCOPES.USER_CREATE)) + canCreateOrUpdateAll || + (canCreateOrUpdateJurisdiction && + !roleScopes(id).some((scope) => + ( + [SCOPES.USER_CREATE, SCOPES.USER_UPDATE] as string[] + ).includes(scope) + )) ) .map((role) => ({ value: role.id,