Criação de nova rule para que somente o administrador acesse as mensagens da fila(queues
parent
790b2c11a9
commit
723f094e5e
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useReducer, useState } from "react";
|
||||
import React, { useEffect, useReducer, useState, useContext } from "react";
|
||||
|
||||
import openSocket from "socket.io-client";
|
||||
|
||||
|
@ -28,6 +28,9 @@ import QueueModal from "../../components/QueueModal";
|
|||
import { toast } from "react-toastify";
|
||||
import ConfirmationModal from "../../components/ConfirmationModal";
|
||||
|
||||
import { AuthContext } from "../../context/Auth/AuthContext";
|
||||
import { Can } from "../../components/Can";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
mainPaper: {
|
||||
flex: 1,
|
||||
|
@ -88,6 +91,8 @@ const reducer = (state, action) => {
|
|||
const Queues = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const { user } = useContext(AuthContext);
|
||||
|
||||
const [queues, dispatch] = useReducer(reducer, []);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
|
@ -159,6 +164,10 @@ const Queues = () => {
|
|||
};
|
||||
|
||||
return (
|
||||
<Can
|
||||
role={user.profile}
|
||||
perform="queues-view:show"
|
||||
yes={() => (
|
||||
<MainContainer>
|
||||
<ConfirmationModal
|
||||
title={
|
||||
|
@ -262,6 +271,8 @@ const Queues = () => {
|
|||
</Table>
|
||||
</Paper>
|
||||
</MainContainer>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ const rules = {
|
|||
|
||||
"connections-view:show",
|
||||
"dashboard-view:show",
|
||||
"queues-view:show",
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue