diff --git a/packages/gateway/src/features/role/utils.ts b/packages/gateway/src/features/role/utils.ts index 0d1e9767ee..e3cec0da12 100644 --- a/packages/gateway/src/features/role/utils.ts +++ b/packages/gateway/src/features/role/utils.ts @@ -1,5 +1,3 @@ -import { Scope } from '@opencrvs/commons/authentication' - /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,6 +9,8 @@ import { Scope } from '@opencrvs/commons/authentication' * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ +import { Scope } from '@opencrvs/commons/authentication' + export const SYSTEM_ROLE_KEYS = [ 'FIELD_AGENT', 'LOCAL_REGISTRAR', diff --git a/packages/gateway/src/features/user/root-resolvers.ts b/packages/gateway/src/features/user/root-resolvers.ts index 89722b5ee3..1b38d9eadf 100644 --- a/packages/gateway/src/features/user/root-resolvers.ts +++ b/packages/gateway/src/features/user/root-resolvers.ts @@ -274,11 +274,10 @@ export const resolvers: GQLResolver = { ) } - // const roles = await getRoles(authHeader) const { scope: loggedInUserScope } = getTokenPayload( authHeader.Authorization.split(' ')[1] ) - debugger + if (!canAssignRole(loggedInUserScope, user)) { throw Error('Create user is only allowed for sysadmin/natlsysadmin') }