From e409f12544731bab525208d3793042c3b7f1519f Mon Sep 17 00:00:00 2001 From: Zoltan Runyo <zoltan.runyo@ess.eu> Date: Fri, 4 Mar 2022 17:04:38 +0100 Subject: [PATCH] Fix access level handling for IOC list --- src/views/IOC/IOCListView.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/IOC/IOCListView.js b/src/views/IOC/IOCListView.js index 4e0e8ba3..7d66b438 100644 --- a/src/views/IOC/IOCListView.js +++ b/src/views/IOC/IOCListView.js @@ -8,6 +8,7 @@ import { useIOCSearch, userContext } from "../../api/SwaggerApi"; import { makeStyles } from '@material-ui/core/styles'; import { initRequestParams } from "../../components/common/Helper"; import { SearchBar } from "../../components/common/SearchBar/SearchBar"; +import AccessControl from '../../components/auth/AccessControl'; const useStyles = makeStyles((theme) => ({ root: { @@ -86,12 +87,15 @@ export function IOCListView() { <Paper className={classes.root}> <Grid container spacing={1}> <Grid item xs={12} md={12}> - <Box display="flex" justifyContent="end" p={2} m={1}> - <FormControlLabel className={classes.formControl} - control={<Switch checked={ownOnly} onChange={handleChangeOwn} />} - label={<Typography variant="h5">My IOCs</Typography>} - /> - </Box> + <AccessControl allowedRoles={["DeploymentToolAdmin", "DeploymentToolIntegrator"]} + renderNoAccess={() => <></>} > + <Box display="flex" justifyContent="end" p={2} m={1}> + <FormControlLabel className={classes.formControl} + control={<Switch checked={ownOnly} onChange={handleChangeOwn} />} + label={<Typography variant="h5">My IOCs</Typography>} + /> + </Box> + </AccessControl> </Grid> <Grid item xs={12} md={12}> {content} -- GitLab