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

(User Roles) Remove legacy scopes #7792

Open
wants to merge 19 commits into
base: configurable-roles
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 0 additions & 2 deletions packages/client/src/tests/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,6 @@ type Query {
to: Date
): [Notification]
fetchBirthRegistration(id: ID!): BirthRegistration
searchBirthRegistrations(fromDate: Date, toDate: Date): [BirthRegistration]
searchDeathRegistrations(fromDate: Date, toDate: Date): [DeathRegistration]
queryRegistrationByIdentifier(identifier: ID!): BirthRegistration
queryPersonByIdentifier(identifier: ID!): Person
listBirthRegistrations(
Expand Down
10 changes: 0 additions & 10 deletions packages/client/src/tests/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,6 @@ export const ACTION_STATUS_MAP = {
SUBMISSION_STATUS.READY_TO_REQUEST_CORRECTION
} as const

export const validateScopeToken = jwt.sign(
{ scope: ['validate'] },
readFileSync('./test/cert.key'),
{
algorithm: 'RS256',
issuer: 'opencrvs:auth-service',
audience: 'opencrvs:gateway-user'
}
)

export function flushPromises() {
return new Promise((resolve) => setImmediate(resolve))
}
Expand Down
4 changes: 0 additions & 4 deletions packages/client/src/utils/gateway-deprecated-do-not-use.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { GraphQLResolveInfo, GraphQLScalarType } from 'graphql'
export interface GQLQuery {
listNotifications?: Array<GQLNotification | null>
fetchBirthRegistration?: GQLBirthRegistration
searchBirthRegistrations?: Array<GQLBirthRegistration | null>
searchDeathRegistrations?: Array<GQLDeathRegistration | null>
queryRegistrationByIdentifier?: GQLBirthRegistration
queryPersonByIdentifier?: GQLPerson
listBirthRegistrations?: GQLBirthRegResultSet
Expand Down Expand Up @@ -2032,8 +2030,6 @@ export interface GQLResolver {
export interface GQLQueryTypeResolver<TParent = any> {
listNotifications?: QueryToListNotificationsResolver<TParent>
fetchBirthRegistration?: QueryToFetchBirthRegistrationResolver<TParent>
searchBirthRegistrations?: QueryToSearchBirthRegistrationsResolver<TParent>
searchDeathRegistrations?: QueryToSearchDeathRegistrationsResolver<TParent>
queryRegistrationByIdentifier?: QueryToQueryRegistrationByIdentifierResolver<TParent>
queryPersonByIdentifier?: QueryToQueryPersonByIdentifierResolver<TParent>
listBirthRegistrations?: QueryToListBirthRegistrationsResolver<TParent>
Expand Down
2 changes: 0 additions & 2 deletions packages/client/src/utils/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,8 +1562,6 @@ export type Query = {
queryPersonByIdentifier?: Maybe<Person>
queryPersonByNidIdentifier?: Maybe<Person>
queryRegistrationByIdentifier?: Maybe<BirthRegistration>
searchBirthRegistrations?: Maybe<Array<Maybe<BirthRegistration>>>
searchDeathRegistrations?: Maybe<Array<Maybe<DeathRegistration>>>
searchEvents?: Maybe<EventSearchResultSet>
searchFieldAgents?: Maybe<SearchFieldAgentResult>
searchUsers?: Maybe<SearchUserResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const EVENT_CREATION_TIME = 1583322631424 // Wed Mar 04 2020 13:50:31 GMT+0200 (
const SEND_FOR_VALIDATION_TIME = 1582912800000 // Fri Feb 28 2020 20:00:00 GMT+0200 (Eastern European Standard Time)

const registerScopeToken = jwt.sign(
{ scope: ['register'] },
{ scope: ['record.register'] },
readFileSync('./test/cert.key'),
{
algorithm: 'RS256',
Expand Down
98 changes: 10 additions & 88 deletions packages/config/src/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import {
createCertificateHandler,
getActiveCertificatesHandler,
getCertificateHandler,
requestActiveCertificate,
requestNewCertificate,
updateCertificate,
updateCertificateHandler
} from '@config/handlers/certificate/certificateHandler'
import configHandler, {
getLoginConfigHandler
} from '@config/handlers/application/applicationConfigHandler'
Expand Down Expand Up @@ -73,13 +64,14 @@ export default function getRoutes(): ServerRoute[] {
options: {
auth: {
scope: [
RouteScope.NATLSYSADMIN,
RouteScope.DECLARE,
RouteScope.REGISTER,
RouteScope.CERTIFY,
RouteScope.PERFORMANCE,
RouteScope.SYSADMIN,
RouteScope.VALIDATE
'config.update-all',
'record.declare-birth',
'record.declare-death',
'record.declare-marriage',
'record.register',
'record.certify',
'performance.read',
'record.submit-for-approval'
]
},
tags: ['api'],
Expand Down Expand Up @@ -114,76 +106,6 @@ export default function getRoutes(): ServerRoute[] {
description: 'Retrieve forms'
}
},
{
method: 'POST',
path: '/getCertificate',
handler: getCertificateHandler,
options: {
tags: ['api'],
description: 'Retrieves certificate',
auth: {
scope: [
RouteScope.NATLSYSADMIN,
RouteScope.REGISTER,
RouteScope.CERTIFY,
RouteScope.VALIDATE
]
},
validate: {
payload: requestActiveCertificate
}
}
},
{
method: 'GET',
path: '/getActiveCertificates',
handler: getActiveCertificatesHandler,
options: {
tags: ['api'],
description: 'Retrieves active certificates for birth and death',
auth: {
scope: [
RouteScope.NATLSYSADMIN,
RouteScope.DECLARE,
RouteScope.REGISTER,
RouteScope.CERTIFY,
RouteScope.PERFORMANCE,
RouteScope.SYSADMIN,
RouteScope.VALIDATE
]
}
}
},
{
method: 'POST',
path: '/createCertificate',
handler: createCertificateHandler,
options: {
tags: ['api'],
description: 'Creates a new Certificate',
auth: {
scope: [RouteScope.NATLSYSADMIN]
},
validate: {
payload: requestNewCertificate
}
}
},
{
method: 'POST',
path: '/updateCertificate',
handler: updateCertificateHandler,
options: {
tags: ['api'],
description: 'Updates an existing Certificate',
auth: {
scope: [RouteScope.NATLSYSADMIN]
},
validate: {
payload: updateCertificate
}
}
},
{
method: 'GET',
path: '/dashboardQueries',
Expand Down Expand Up @@ -214,7 +136,7 @@ export default function getRoutes(): ServerRoute[] {
options: {
tags: ['api'],
auth: {
scope: ['natlsysadmin']
scope: ['config.update-all']
},
description: 'Create a location',
validate: {
Expand Down Expand Up @@ -242,7 +164,7 @@ export default function getRoutes(): ServerRoute[] {
options: {
tags: ['api'],
auth: {
scope: ['natlsysadmin']
scope: ['config.update-all']
},
description: 'Update a location or facility',
validate: {
Expand Down
Loading
Loading