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";
|
import openSocket from "socket.io-client";
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ import QueueModal from "../../components/QueueModal";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import ConfirmationModal from "../../components/ConfirmationModal";
|
import ConfirmationModal from "../../components/ConfirmationModal";
|
||||||
|
|
||||||
|
import { AuthContext } from "../../context/Auth/AuthContext";
|
||||||
|
import { Can } from "../../components/Can";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
mainPaper: {
|
mainPaper: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -88,6 +91,8 @@ const reducer = (state, action) => {
|
||||||
const Queues = () => {
|
const Queues = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const { user } = useContext(AuthContext);
|
||||||
|
|
||||||
const [queues, dispatch] = useReducer(reducer, []);
|
const [queues, dispatch] = useReducer(reducer, []);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
@ -159,6 +164,10 @@ const Queues = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Can
|
||||||
|
role={user.profile}
|
||||||
|
perform="queues-view:show"
|
||||||
|
yes={() => (
|
||||||
<MainContainer>
|
<MainContainer>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={
|
title={
|
||||||
|
@ -262,6 +271,8 @@ const Queues = () => {
|
||||||
</Table>
|
</Table>
|
||||||
</Paper>
|
</Paper>
|
||||||
</MainContainer>
|
</MainContainer>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ const rules = {
|
||||||
|
|
||||||
"connections-view:show",
|
"connections-view:show",
|
||||||
"dashboard-view:show",
|
"dashboard-view:show",
|
||||||
|
"queues-view:show",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue