Restrição de operação de crud para criação e edição de filas. Apenas o master tem esse poder

pull/1/head
adriano 2022-06-15 20:36:21 -03:00
parent 755584a881
commit 9bb316a0cf
3 changed files with 279 additions and 236 deletions

View File

@ -430,13 +430,19 @@ const Connections = () => {
)} )}
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
<Can
role={user.profile}
perform="show-icon-edit-whatsapp"
yes={() => (
<IconButton <IconButton
size="small" size="small"
onClick={() => handleEditWhatsApp(whatsApp)} onClick={() => handleEditWhatsApp(whatsApp)}
> >
<Edit /> <Edit />
</IconButton> </IconButton>
)}
/>
<Can <Can

View File

@ -172,8 +172,7 @@ const Queues = () => {
<ConfirmationModal <ConfirmationModal
title={ title={
selectedQueue && selectedQueue &&
`${i18n.t("queues.confirmationModal.deleteTitle")} ${ `${i18n.t("queues.confirmationModal.deleteTitle")} ${selectedQueue.name
selectedQueue.name
}?` }?`
} }
open={confirmModalOpen} open={confirmModalOpen}
@ -189,6 +188,12 @@ const Queues = () => {
/> />
<MainHeader> <MainHeader>
<Title>{i18n.t("queues.title")}</Title> <Title>{i18n.t("queues.title")}</Title>
<Can
role={user.profile}
perform="show-icon-add-queue"
yes={() => (
<MainHeaderButtonsWrapper> <MainHeaderButtonsWrapper>
<Button <Button
variant="contained" variant="contained"
@ -198,6 +203,10 @@ const Queues = () => {
{i18n.t("queues.buttons.add")} {i18n.t("queues.buttons.add")}
</Button> </Button>
</MainHeaderButtonsWrapper> </MainHeaderButtonsWrapper>
)}
/>
</MainHeader> </MainHeader>
<Paper className={classes.mainPaper} variant="outlined"> <Paper className={classes.mainPaper} variant="outlined">
<Table size="small"> <Table size="small">
@ -245,14 +254,30 @@ const Queues = () => {
</Typography> </Typography>
</div> </div>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
<Can
role={user.profile}
perform="show-icon-edit-queue"
yes={() => (
<IconButton <IconButton
size="small" size="small"
onClick={() => handleEditQueue(queue)} onClick={() => handleEditQueue(queue)}
> >
<Edit /> <Edit />
</IconButton> </IconButton>
)}
/>
<Can
role={user.profile}
perform="show-icon-delete-queue"
yes={() => (
<IconButton <IconButton
size="small" size="small"
onClick={() => { onClick={() => {
@ -262,6 +287,9 @@ const Queues = () => {
> >
<DeleteOutline /> <DeleteOutline />
</IconButton> </IconButton>
)}
/>
</TableCell> </TableCell>
</TableRow> </TableRow>
))} ))}

View File

@ -5,6 +5,8 @@ const rules = {
admin: { admin: {
static: [ static: [
"show-icon-edit-whatsapp",
"drawer-admin-items:view", "drawer-admin-items:view",
"tickets-manager:showall", "tickets-manager:showall",
"user-modal:editProfile", "user-modal:editProfile",
@ -22,6 +24,13 @@ const rules = {
master: { master: {
static: [ static: [
"show-icon-edit-whatsapp",
"show-icon-add-queue",
"show-icon-edit-queue",
"show-icon-delete-queue",
"drawer-admin-items:view", "drawer-admin-items:view",
"tickets-manager:showall", "tickets-manager:showall",
"user-modal:editProfile", "user-modal:editProfile",