diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml index 42bdcc8c..9b741cd6 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/local_development.yml @@ -20,6 +20,16 @@ groups: permissions: admin: - groups: [admin, group1, group2] + groups: [admin, group1] allowed_permissions: [create, read, update, delete] uri: /* + + basic: + groups: [group2] + allowed_permissions: [all] + uri: BASIC + + basic-read: + groups: [group2] + allowed_permissions: [read] + uri: PG:ALL diff --git a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx index 60829366..2b54bf4f 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx @@ -20,6 +20,7 @@ type OwnProps = { processGroup?: ProcessGroup; headerElement?: ReactElement; showNoItemsDisplayText?: boolean; + userCanCreateProcessModels?: boolean; }; export default function ProcessGroupListTiles({ @@ -27,6 +28,7 @@ export default function ProcessGroupListTiles({ processGroup, headerElement, showNoItemsDisplayText, + userCanCreateProcessModels, }: OwnProps) { const [searchParams] = useSearchParams(); @@ -84,7 +86,7 @@ export default function ProcessGroupListTiles({ ); }); - } else { + } else if (userCanCreateProcessModels) { displayText = (

There are no process groups to display. You can add one by clicking @@ -92,6 +94,12 @@ export default function ProcessGroupListTiles({ additional process groups and / or process models.

); + } else { + displayText = ( +

+ There are no process groups to display +

+ ); } return displayText; }; diff --git a/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx index d69787f0..4e570ff9 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx @@ -19,6 +19,7 @@ type OwnProps = { checkPermissions?: boolean; onLoadFunction?: Function; showNoItemsDisplayText?: boolean; + userCanCreateProcessModels?: boolean; }; export default function ProcessModelListTiles({ @@ -28,6 +29,7 @@ export default function ProcessModelListTiles({ checkPermissions = true, onLoadFunction, showNoItemsDisplayText, + userCanCreateProcessModels, }: OwnProps) { const [searchParams] = useSearchParams(); const [processModels, setProcessModels] = useState( @@ -94,7 +96,7 @@ export default function ProcessModelListTiles({ ); }); - } else { + } else if (userCanCreateProcessModels) { displayText = (

There are no process models to display. You can add one by clicking @@ -103,6 +105,12 @@ export default function ProcessModelListTiles({ runnable workflow.

); + } else { + displayText = ( +

+ There are no process models to display +

+ ); } return displayText; }; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx index e676173c..89d9935a 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx @@ -34,7 +34,9 @@ export default function ProcessGroupShow() { [targetUris.processGroupShowPath]: ['PUT', 'DELETE'], [targetUris.processModelCreatePath]: ['POST'], }; - const { ability } = usePermissionFetcher(permissionRequestData); + const { ability, permissionsLoaded } = usePermissionFetcher( + permissionRequestData + ); useEffect(() => { const processResult = (result: any) => { @@ -63,7 +65,7 @@ export default function ProcessGroupShow() { } }; - if (processGroup) { + if (processGroup && permissionsLoaded) { const modifiedProcessGroupId = modifyProcessIdentifierForPathParam( processGroup.id ); @@ -137,6 +139,10 @@ export default function ProcessGroupShow() { processGroup={processGroup} defaultProcessModels={processGroup.process_models} showNoItemsDisplayText={showNoItemsDisplayText} + userCanCreateProcessModels={ability.can( + 'POST', + targetUris.processModelCreatePath + )} />

@@ -145,6 +151,10 @@ export default function ProcessGroupShow() { headerElement={

Process Groups

} defaultProcessGroups={processGroup.process_groups} showNoItemsDisplayText={showNoItemsDisplayText} + userCanCreateProcessModels={ability.can( + 'POST', + targetUris.processGroupListPath + )} />