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 align="center">
<Can
role={user.profile}
perform="show-icon-edit-whatsapp"
yes={() => (
<IconButton
size="small"
onClick={() => handleEditWhatsApp(whatsApp)}
>
<Edit />
</IconButton>
)}
/>
<Can

View File

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

View File

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