Skip to content

Commit

Permalink
chore: remove additional validate instances
Browse files Browse the repository at this point in the history
  • Loading branch information
tumbledwyer committed Oct 29, 2024
1 parent b6578df commit 2eaee42
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
12 changes: 11 additions & 1 deletion packages/client/src/workqueue/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
UPDATE_REGISTRAR_WORKQUEUE_SUCCESS,
UPDATE_WORKQUEUE_PAGINATION
} from './actions'
import { Scope, SCOPES } from '@client/utils/gateway'

export interface IQueryData {
inProgressTab: GQLEventSearchResultSet
Expand Down Expand Up @@ -154,7 +155,16 @@ async function getFilteredDeclarations(
// for other agents, check if the status of workqueue declaration
// has changed and if that declaration is saved in the store
// also declaration should not show as unassigned when it is being submitted
if (scope?.includes('declare'))
const declareScopes = [
SCOPES.RECORD_DECLARE_BIRTH,
SCOPES.RECORD_DECLARE_DEATH,
SCOPES.RECORD_DECLARE_MARRIAGE,
SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION,
SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION,
SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION
] as Scope[]

if (scope?.some((x) => declareScopes.includes(x)))
return {
currentlyDownloadedDeclarations: savedDeclarations,
unassignedDeclarations: []
Expand Down
21 changes: 5 additions & 16 deletions packages/commons/src/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export { scopes, Scope, SCOPES } from './scopes'
/** All the scopes system/integration can be assigned to */
export const SYSTEM_INTEGRATION_SCOPES = {
recordsearch: SCOPES.RECORDSEARCH,
declare: SCOPES.DECLARE,
webhook: SCOPES.WEBHOOK,
nationalId: SCOPES.NATIONALID
} as const
Expand All @@ -38,9 +37,6 @@ export const DEFAULT_ROLES_DEFINITION = [
id: 'userRole.fieldAgent'
},
scopes: [
// old scope for bw compability
SCOPES.DECLARE,

// new scopes
SCOPES.RECORD_DECLARE_BIRTH,
SCOPES.RECORD_DECLARE_DEATH,
Expand All @@ -63,27 +59,25 @@ export const DEFAULT_ROLES_DEFINITION = [
id: 'userRole.registrationAgent'
},
scopes: [
SCOPES.VALIDATE,
SCOPES.PERFORMANCE,
SCOPES.CERTIFY,
SCOPES.RECORD_DECLARE_BIRTH,
SCOPES.RECORD_DECLARE_DEATH,
SCOPES.RECORD_DECLARE_MARRIAGE,
SCOPES.RECORD_DECLARATION_REVIEW,
SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
SCOPES.RECORD_DECLARATION_ARCHIVE,
SCOPES.RECORD_DECLARATION_REINSTATE,
SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
SCOPES.RECORD_PRINT_RECORDS,
SCOPES.RECORD_REGISTRATION_PRINT,
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
SCOPES.RECORD_EXPORT_RECORDS,
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
SCOPES.RECORD_CREATE_COMMENTS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
SCOPES.SEARCH_BIRTH,
SCOPES.SEARCH_DEATH,
Expand All @@ -107,22 +101,21 @@ export const DEFAULT_ROLES_DEFINITION = [
SCOPES.RECORD_DECLARE_BIRTH,
SCOPES.RECORD_DECLARE_DEATH,
SCOPES.RECORD_DECLARE_MARRIAGE,
SCOPES.RECORD_DECLARATION_REVIEW,
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
SCOPES.RECORD_REVIEW_DUPLICATES,
SCOPES.RECORD_DECLARATION_ARCHIVE,
SCOPES.RECORD_DECLARATION_REINSTATE,
SCOPES.RECORD_REGISTER,
SCOPES.RECORD_REGISTRATION_CORRECT,
SCOPES.RECORD_PRINT_RECORDS,
SCOPES.RECORD_REGISTRATION_PRINT,
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
SCOPES.RECORD_EXPORT_RECORDS,
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
SCOPES.RECORD_CREATE_COMMENTS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
SCOPES.SEARCH_BIRTH,
SCOPES.SEARCH_DEATH,
Expand All @@ -144,7 +137,6 @@ export const DEFAULT_ROLES_DEFINITION = [
SCOPES.USER_READ_MY_OFFICE,
SCOPES.USER_CREATE_MY_JURISDICTION,
SCOPES.USER_UPDATE_MY_JURISDICTION,
SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
Expand All @@ -165,7 +157,6 @@ export const DEFAULT_ROLES_DEFINITION = [
SCOPES.USER_CREATE,
SCOPES.USER_READ,
SCOPES.USER_UPDATE,
SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
Expand Down Expand Up @@ -194,7 +185,7 @@ export const DEFAULT_ROLES_DEFINITION = [
}>

export const DEFAULT_SYSTEM_INTEGRATION_ROLE_SCOPES = {
HEALTH: [SCOPES.DECLARE, SCOPES.NOTIFICATION_API],
HEALTH: [SCOPES.NOTIFICATION_API],
NATIONAL_ID: [SCOPES.NATIONALID],
RECORD_SEARCH: [SCOPES.RECORDSEARCH],
WEBHOOK: [SCOPES.WEBHOOK]
Expand All @@ -207,12 +198,10 @@ export const DEFAULT_SYSTEM_INTEGRATION_ROLE_SCOPES = {

export const LEGACY_SCOPES = {
demo: SCOPES.DEMO,
declare: SCOPES.DECLARE,
register: SCOPES.REGISTER,
certify: SCOPES.CERTIFY,
performance: SCOPES.PERFORMANCE,
systemAdmin: SCOPES.SYSADMIN,
validate: SCOPES.VALIDATE,
nationalSystemAdmin: SCOPES.NATLSYSADMIN,
/** Bypasses the rate limiting in gateway. Useful for data seeder. */
bypassRateLimit: SCOPES.BYPASSRATELIMIT,
Expand Down

0 comments on commit 2eaee42

Please sign in to comment.