diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/development.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/development.yml index e501f108d..e36ef759c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/development.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/development.yml @@ -85,6 +85,16 @@ permissions: users: [] allowed_permissions: [read] uri: /v1.0/process-models + read-process-instance-list: + groups: [everybody] + users: [] + allowed_permissions: [read] + uri: /v1.0/process-instances + read-process-instance-report-list: + groups: [everybody] + users: [] + allowed_permissions: [read] + uri: /v1.0/process-instances/reports manage-procurement-admin: groups: ["Project Lead"] diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml index 1a19427f4..cb8a50b8c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml @@ -85,6 +85,11 @@ permissions: users: [] allowed_permissions: [read] uri: /v1.0/process-models + read-process-instance-list: + groups: [everybody] + users: [] + allowed_permissions: [read] + uri: /v1.0/process-instances manage-procurement-admin: groups: ["Project Lead"] diff --git a/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx b/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx index 99b798af1..80c78987a 100644 --- a/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx +++ b/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx @@ -12,6 +12,7 @@ export const useUriListForPermissions = () => { processInstanceActionPath: `/v1.0/process-models/${params.process_model_id}/process-instances`, processInstanceListPath: '/v1.0/process-instances', processInstanceTaskListPath: `/v1.0/process-instances/${params.process_model_id}/${params.process_instance_id}/tasks`, + processInstanceReportListPath: '/v1.0/process-instances/reports', processModelCreatePath: `/v1.0/process-models/${params.process_group_id}`, processModelFileCreatePath: `/v1.0/process-models/${params.process_model_id}/files`, processModelFileShowPath: `/v1.0/process-models/${params.process_model_id}/files/${params.file_name}`, diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceReportList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceReportList.tsx index 298008d11..906fb3142 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceReportList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceReportList.tsx @@ -2,12 +2,22 @@ import { useEffect, useState } from 'react'; // @ts-ignore import { Button, Table } from '@carbon/react'; import { useParams, Link } from 'react-router-dom'; +import { Can } from '@casl/react'; import HttpService from '../services/HttpService'; +import { useUriListForPermissions } from '../hooks/UriListForPermissions'; +import { PermissionsToCheck } from '../interfaces'; +import { usePermissionFetcher } from '../hooks/PermissionService'; export default function ProcessInstanceReportList() { const params = useParams(); const [processInstanceReports, setProcessInstanceReports] = useState([]); + const { targetUris } = useUriListForPermissions(); + const permissionRequestData: PermissionsToCheck = { + [targetUris.processInstanceReportListPath]: ['POST'], + }; + const { ability } = usePermissionFetcher(permissionRequestData); + useEffect(() => { HttpService.makeCallToBackend({ path: `/process-instances/reports`, @@ -45,9 +55,11 @@ export default function ProcessInstanceReportList() { const headerStuff = ( <>

Process Instance Perspectives

- + + + ); if (processInstanceReports?.length > 0) {