mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-03-01 01:20:45 +00:00
do not tell users to add a process model/group if they do not have access to do so w/ burnettk
This commit is contained in:
parent
c122926e01
commit
1197a1a51a
@ -20,6 +20,16 @@ groups:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
admin:
|
admin:
|
||||||
groups: [admin, group1, group2]
|
groups: [admin, group1]
|
||||||
allowed_permissions: [create, read, update, delete]
|
allowed_permissions: [create, read, update, delete]
|
||||||
uri: /*
|
uri: /*
|
||||||
|
|
||||||
|
basic:
|
||||||
|
groups: [group2]
|
||||||
|
allowed_permissions: [all]
|
||||||
|
uri: BASIC
|
||||||
|
|
||||||
|
basic-read:
|
||||||
|
groups: [group2]
|
||||||
|
allowed_permissions: [read]
|
||||||
|
uri: PG:ALL
|
||||||
|
@ -20,6 +20,7 @@ type OwnProps = {
|
|||||||
processGroup?: ProcessGroup;
|
processGroup?: ProcessGroup;
|
||||||
headerElement?: ReactElement;
|
headerElement?: ReactElement;
|
||||||
showNoItemsDisplayText?: boolean;
|
showNoItemsDisplayText?: boolean;
|
||||||
|
userCanCreateProcessModels?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ProcessGroupListTiles({
|
export default function ProcessGroupListTiles({
|
||||||
@ -27,6 +28,7 @@ export default function ProcessGroupListTiles({
|
|||||||
processGroup,
|
processGroup,
|
||||||
headerElement,
|
headerElement,
|
||||||
showNoItemsDisplayText,
|
showNoItemsDisplayText,
|
||||||
|
userCanCreateProcessModels,
|
||||||
}: OwnProps) {
|
}: OwnProps) {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
|
|
||||||
@ -84,7 +86,7 @@ export default function ProcessGroupListTiles({
|
|||||||
</ClickableTile>
|
</ClickableTile>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else if (userCanCreateProcessModels) {
|
||||||
displayText = (
|
displayText = (
|
||||||
<p className="no-results-message">
|
<p className="no-results-message">
|
||||||
There are no process groups to display. You can add one by clicking
|
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.
|
additional process groups and / or process models.
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
displayText = (
|
||||||
|
<p className="no-results-message">
|
||||||
|
There are no process groups to display
|
||||||
|
</p>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return displayText;
|
return displayText;
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ type OwnProps = {
|
|||||||
checkPermissions?: boolean;
|
checkPermissions?: boolean;
|
||||||
onLoadFunction?: Function;
|
onLoadFunction?: Function;
|
||||||
showNoItemsDisplayText?: boolean;
|
showNoItemsDisplayText?: boolean;
|
||||||
|
userCanCreateProcessModels?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ProcessModelListTiles({
|
export default function ProcessModelListTiles({
|
||||||
@ -28,6 +29,7 @@ export default function ProcessModelListTiles({
|
|||||||
checkPermissions = true,
|
checkPermissions = true,
|
||||||
onLoadFunction,
|
onLoadFunction,
|
||||||
showNoItemsDisplayText,
|
showNoItemsDisplayText,
|
||||||
|
userCanCreateProcessModels,
|
||||||
}: OwnProps) {
|
}: OwnProps) {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [processModels, setProcessModels] = useState<ProcessModel[] | null>(
|
const [processModels, setProcessModels] = useState<ProcessModel[] | null>(
|
||||||
@ -94,7 +96,7 @@ export default function ProcessModelListTiles({
|
|||||||
</Tile>
|
</Tile>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else if (userCanCreateProcessModels) {
|
||||||
displayText = (
|
displayText = (
|
||||||
<p className="no-results-message">
|
<p className="no-results-message">
|
||||||
There are no process models to display. You can add one by clicking
|
There are no process models to display. You can add one by clicking
|
||||||
@ -103,6 +105,12 @@ export default function ProcessModelListTiles({
|
|||||||
runnable workflow.
|
runnable workflow.
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
displayText = (
|
||||||
|
<p className="no-results-message">
|
||||||
|
There are no process models to display
|
||||||
|
</p>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return displayText;
|
return displayText;
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,9 @@ export default function ProcessGroupShow() {
|
|||||||
[targetUris.processGroupShowPath]: ['PUT', 'DELETE'],
|
[targetUris.processGroupShowPath]: ['PUT', 'DELETE'],
|
||||||
[targetUris.processModelCreatePath]: ['POST'],
|
[targetUris.processModelCreatePath]: ['POST'],
|
||||||
};
|
};
|
||||||
const { ability } = usePermissionFetcher(permissionRequestData);
|
const { ability, permissionsLoaded } = usePermissionFetcher(
|
||||||
|
permissionRequestData
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const processResult = (result: any) => {
|
const processResult = (result: any) => {
|
||||||
@ -63,7 +65,7 @@ export default function ProcessGroupShow() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (processGroup) {
|
if (processGroup && permissionsLoaded) {
|
||||||
const modifiedProcessGroupId = modifyProcessIdentifierForPathParam(
|
const modifiedProcessGroupId = modifyProcessIdentifierForPathParam(
|
||||||
processGroup.id
|
processGroup.id
|
||||||
);
|
);
|
||||||
@ -137,6 +139,10 @@ export default function ProcessGroupShow() {
|
|||||||
processGroup={processGroup}
|
processGroup={processGroup}
|
||||||
defaultProcessModels={processGroup.process_models}
|
defaultProcessModels={processGroup.process_models}
|
||||||
showNoItemsDisplayText={showNoItemsDisplayText}
|
showNoItemsDisplayText={showNoItemsDisplayText}
|
||||||
|
userCanCreateProcessModels={ability.can(
|
||||||
|
'POST',
|
||||||
|
targetUris.processModelCreatePath
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -145,6 +151,10 @@ export default function ProcessGroupShow() {
|
|||||||
headerElement={<h2 className="clear-left">Process Groups</h2>}
|
headerElement={<h2 className="clear-left">Process Groups</h2>}
|
||||||
defaultProcessGroups={processGroup.process_groups}
|
defaultProcessGroups={processGroup.process_groups}
|
||||||
showNoItemsDisplayText={showNoItemsDisplayText}
|
showNoItemsDisplayText={showNoItemsDisplayText}
|
||||||
|
userCanCreateProcessModels={ability.can(
|
||||||
|
'POST',
|
||||||
|
targetUris.processGroupListPath
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</ul>
|
</ul>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user