Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: configurable roles tasks #7645

Merged
merged 19 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 28 additions & 227 deletions packages/client/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3569,6 +3569,18 @@
"name": "Certificate",
"description": null,
"fields": [
{
"name": "certifier",
"description": null,
"args": [],
"type": {
"kind": "OBJECT",
"name": "User",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "collector",
"description": null,
Expand Down Expand Up @@ -7268,8 +7280,8 @@
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "SystemRoleType",
"kind": "OBJECT",
"name": "UserRole",
"ofType": null
}
},
Expand Down Expand Up @@ -16813,174 +16825,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Response",
"description": null,
"fields": [
{
"name": "roleIdMap",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Map",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Role",
"description": null,
"fields": [
{
"name": "_id",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "labels",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "RoleLabel",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "RoleInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "_id",
"description": null,
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "labels",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "LabelInput",
"ofType": null
}
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "RoleLabel",
"description": null,
"fields": [
{
"name": "label",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lang",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SearchFieldAgentResponse",
Expand Down Expand Up @@ -17663,59 +17507,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "SystemRoleType",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "FIELD_AGENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "LOCAL_REGISTRAR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "LOCAL_SYSTEM_ADMIN",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "NATIONAL_REGISTRAR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "NATIONAL_SYSTEM_ADMIN",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PERFORMANCE_MANAGEMENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REGISTRATION_AGENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SystemSecret",
Expand Down Expand Up @@ -20422,7 +20213,11 @@
"name": "include",
"description": "Directs the executor to include this field or fragment only when the `if` argument is true.",
"isRepeatable": false,
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"args": [
{
"name": "if",
Expand All @@ -20446,7 +20241,11 @@
"name": "skip",
"description": "Directs the executor to skip this field or fragment when the `if` argument is true.",
"isRepeatable": false,
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"args": [
{
"name": "if",
Expand All @@ -20470,7 +20269,9 @@
"name": "specifiedBy",
"description": "Exposes a URL that specifies the behaviour of this scalar.",
"isRepeatable": false,
"locations": ["SCALAR"],
"locations": [
"SCALAR"
],
"args": [
{
"name": "url",
Expand All @@ -20492,4 +20293,4 @@
}
]
}
}
}
13 changes: 11 additions & 2 deletions packages/client/src/declarations/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
filterProcessingDeclarations,
filterProcessingDeclarationsFromQuery
} from '.'
import { Event, SystemRoleType, Status } from '@client/utils/gateway'
import { Event, Status } from '@client/utils/gateway'
import { AppStore, createStore } from '@client/store'
import { mockDeclarationData, flushPromises } from '@client/tests/util'
import { storage } from '@client/storage'
Expand Down Expand Up @@ -331,7 +331,16 @@ describe('archiveDeclaration tests', () => {
}
},
name: [],
localRegistrar: { name: [], role: 'FIELD_AGENT' as SystemRoleType }
localRegistrar: {
name: [],
role: {
label: {
defaultMessage: 'Field Agent',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
}
}
}

indexedDB = {
Expand Down
8 changes: 7 additions & 1 deletion packages/client/src/profile/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ const FETCH_USER = gql`
firstNames
familyName
}
role
role {
label {
id
defaultMessage
description
}
}
signature {
data
type
Expand Down
18 changes: 15 additions & 3 deletions packages/client/src/tests/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import { App } from '@client/App'
import { Event, SystemRoleType, Status, Scope } from '@client/utils/gateway'
import { Event, Status, Scope } from '@client/utils/gateway'
import { UserDetails } from '@client/utils/userUtils'
import { getRegisterForm } from '@client/forms/register/declaration-selectors'
import { getReviewForm } from '@client/forms/register/review-selectors'
Expand Down Expand Up @@ -392,7 +392,13 @@ export const userDetails: UserDetails = {
status: 'active'
},
localRegistrar: {
role: 'LOCAL_REGISTRAR' as SystemRoleType,
role: {
label: {
defaultMessage: 'Local Registrar',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
},
signature: {
data: `data:image/png;base64,${validImageB64String}`,
type: 'image/png'
Expand Down Expand Up @@ -1119,7 +1125,13 @@ export function loginAsFieldAgent(store: AppStore) {
familyName: 'Ashraful'
}
],
role: SystemRoleType.LocalRegistrar,
role: {
label: {
defaultMessage: 'Local Registrar',
description: 'Name for user role Field Agent',
id: 'userRole.fieldAgent'
}
},
signature: undefined
}
}
Expand Down
Loading
Loading