Criação de nova rule para que somente o administrador acesse as configurações(settings)
							parent
							
								
									723f094e5e
								
							
						
					
					
						commit
						78074b0d09
					
				| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import React, { useState, useEffect, useReducer } from "react";
 | 
			
		||||
import React, { useState, useEffect, useReducer, useContext} from "react";
 | 
			
		||||
import { toast } from "react-toastify";
 | 
			
		||||
import openSocket from "socket.io-client";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +30,10 @@ import UserModal from "../../components/UserModal";
 | 
			
		|||
import ConfirmationModal from "../../components/ConfirmationModal";
 | 
			
		||||
import toastError from "../../errors/toastError";
 | 
			
		||||
 | 
			
		||||
//--------
 | 
			
		||||
import { AuthContext } from "../../context/Auth/AuthContext";
 | 
			
		||||
import { Can } from "../../components/Can";
 | 
			
		||||
 | 
			
		||||
const reducer = (state, action) => {
 | 
			
		||||
  if (action.type === "LOAD_USERS") {
 | 
			
		||||
    const users = action.payload;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,6 +90,9 @@ const useStyles = makeStyles((theme) => ({
 | 
			
		|||
const Users = () => {
 | 
			
		||||
  const classes = useStyles();
 | 
			
		||||
  
 | 
			
		||||
  //--------
 | 
			
		||||
	const { user: userA } = useContext(AuthContext); 
 | 
			
		||||
 | 
			
		||||
  const [loading, setLoading] = useState(false);
 | 
			
		||||
  const [pageNumber, setPageNumber] = useState(1);
 | 
			
		||||
  const [hasMore, setHasMore] = useState(false);
 | 
			
		||||
| 
						 | 
				
			
			@ -183,6 +190,11 @@ const Users = () => {
 | 
			
		|||
  };
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
 | 
			
		||||
    <Can
 | 
			
		||||
		  role={userA.profile}
 | 
			
		||||
		  perform="user-view:show"
 | 
			
		||||
		  yes={() => (
 | 
			
		||||
        <MainContainer>
 | 
			
		||||
        <ConfirmationModal
 | 
			
		||||
          title={
 | 
			
		||||
| 
						 | 
				
			
			@ -289,6 +301,10 @@ const Users = () => {
 | 
			
		|||
          </Table>
 | 
			
		||||
        </Paper>
 | 
			
		||||
      </MainContainer>
 | 
			
		||||
		  )}
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ const rules = {
 | 
			
		|||
			"connections-view:show",
 | 
			
		||||
			"dashboard-view:show",
 | 
			
		||||
			"queues-view:show",
 | 
			
		||||
			"user-view:show",
 | 
			
		||||
		],
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue