diff --git a/packages/auth/src/features/refresh/handler.test.ts b/packages/auth/src/features/refresh/handler.test.ts
index 88ee48a863..c5f5784557 100644
--- a/packages/auth/src/features/refresh/handler.test.ts
+++ b/packages/auth/src/features/refresh/handler.test.ts
@@ -81,7 +81,6 @@ describe('authenticate handler receives a request', () => {
SCOPES.USER_CREATE,
SCOPES.USER_READ,
SCOPES.USER_UPDATE,
- SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
diff --git a/packages/auth/src/features/verifyCode/handler.test.ts b/packages/auth/src/features/verifyCode/handler.test.ts
index 22c3331e3c..9a71ba17a5 100644
--- a/packages/auth/src/features/verifyCode/handler.test.ts
+++ b/packages/auth/src/features/verifyCode/handler.test.ts
@@ -77,7 +77,6 @@ describe('authenticate handler receives a request', () => {
SCOPES.USER_CREATE,
SCOPES.USER_READ,
SCOPES.USER_UPDATE,
- SCOPES.ORGANISATION_READ,
SCOPES.ORGANISATION_READ_LOCATIONS,
SCOPES.PERFORMANCE_READ,
SCOPES.PERFORMANCE_READ_DASHBOARDS,
diff --git a/packages/client/src/App.tsx b/packages/client/src/App.tsx
index 9e8aba6e38..b190b12ce7 100644
--- a/packages/client/src/App.tsx
+++ b/packages/client/src/App.tsx
@@ -385,7 +385,7 @@ export function App(props: IAppProps) {
diff --git a/packages/client/src/components/form/ReviewActionComponent.tsx b/packages/client/src/components/form/ReviewActionComponent.tsx
index b8e3884150..d4b9c0b73f 100644
--- a/packages/client/src/components/form/ReviewActionComponent.tsx
+++ b/packages/client/src/components/form/ReviewActionComponent.tsx
@@ -20,6 +20,9 @@ import styled from 'styled-components'
import React, { useState } from 'react'
import { Button } from '@opencrvs/components/lib/Button'
import { Icon } from '@opencrvs/components/lib/Icon'
+import ProtectedComponent from '@client/components/ProtectedComponent'
+import { SCOPES } from '@client/utils/gateway'
+import { usePermissions } from '@client/hooks/useAuthorization'
interface IReviewActionProps extends React.HTMLAttributes {
id?: string
@@ -89,12 +92,12 @@ const ActionContainer = styled.div`
flex-flow: row wrap;
align-items: center;
- button:first-child {
- margin-right: 16px;
- }
+ button {
+ margin: 0 16px 8px 0;
- & > button {
- margin-bottom: 8px;
+ &:last-child {
+ margin-right: 0;
+ }
}
`
@@ -295,8 +298,6 @@ const ACTION_TO_CONTENT_MAP_SKELETON: (
const ReviewActionComponent = ({
id,
- declarationToBeValidated,
- declarationToBeRegistered,
alreadyRejectedDeclaration,
completeDeclaration,
totalFileSizeExceeded,
@@ -308,6 +309,13 @@ const ReviewActionComponent = ({
hasErrorsOnFields
}: IReviewActionProps & IntlShapeProps) => {
const [showSubmitModal, setShowSubmitModal] = useState(false)
+ const { hasAnyScope, hasScope } = usePermissions()
+
+ const declarationToBeRegistered = hasScope(SCOPES.RECORD_REGISTER)
+ const declarationToBeValidated = hasAnyScope([
+ SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
+ SCOPES.RECORD_SUBMIT_FOR_UPDATES
+ ])
const toggleSubmitModalOpen = () => {
setShowSubmitModal(!showSubmitModal)
@@ -336,6 +344,7 @@ const ReviewActionComponent = ({
String(draftDeclaration || alreadyRejectedDeclaration)
].completionStatus[String(completeDeclaration)]) ||
null
+
return !actionContent ? null : (
@@ -354,44 +363,62 @@ const ReviewActionComponent = ({
{declarationToBeRegistered ? (
-
+
+
+
) : declarationToBeValidated ? (
-
+
+
+
) : (
-
+ <>
+
+
+
+
+
+
+ >
)}
-
{rejectDeclarationAction && !alreadyRejectedDeclaration && (