some more perm updates for core user w/ burnettk

This commit is contained in:
jasquat 2022-11-22 17:38:39 -05:00
parent ee61e43237
commit 4143aae16b
4 changed files with 31 additions and 3 deletions

View File

@ -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"]

View File

@ -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"]

View File

@ -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}`,

View File

@ -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 = (
<>
<h1>Process Instance Perspectives</h1>
<Button href="/admin/process-instances/reports/new">
Add a process instance perspective
</Button>
<Can I="POST" a={targetUris.processInstanceListPath} ability={ability}>
<Button href="/admin/process-instances/reports/new">
Add a process instance perspective
</Button>
</Can>
</>
);
if (processInstanceReports?.length > 0) {