Skip to content

Commit

Permalink
Merge pull request #17 from fga-eps-mds/gerenciamento-de-permissoes
Browse files Browse the repository at this point in the history
Gerenciamento de permissoes
  • Loading branch information
guipeeix7 authored Jan 11, 2025
2 parents b67a30b + ee9e531 commit 8747f65
Show file tree
Hide file tree
Showing 24 changed files with 352 additions and 146 deletions.
10 changes: 5 additions & 5 deletions src/Components/SideBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function SideBar() {
}}
/>,
<SideButton
hidden={checkModule(permissions, "users") ? "flex" : "none"}
// hidden={checkModule(permissions, "users") ? "flex" : "none"}
key="filiacao"
text="CADASTROS"
onClick={() => {
Expand All @@ -63,7 +63,7 @@ export default function SideBar() {
}}
/>,
<SideButton
hidden={checkModule(permissions, "finance") ? "flex" : "none"}
// hidden={checkModule(permissions, "finance") ? "flex" : "none"}
key="financeiro"
text="FINANCEIRO"
onClick={() => {
Expand All @@ -72,7 +72,7 @@ export default function SideBar() {
}}
/>,
<SideButton
hidden={checkModule(permissions, "benefits") ? "flex" : "none"}
// hidden={checkModule(permissions, "benefits") ? "flex" : "none"}
key="beneficios"
text="BENEFÍCIOS"
onClick={() => {
Expand All @@ -98,7 +98,7 @@ export default function SideBar() {
}}
/>,
<SideButton
hidden={checkModule(permissions, "users") ? "flex" : "none"}
// hidden={checkModule(permissions, "users") ? "flex" : "none"}
key="carteirinha"
text="CARTEIRINHA"
onClick={() => {
Expand All @@ -116,7 +116,7 @@ export default function SideBar() {
}}
/>,
<SideButton
hidden={checkModule(permissions, "users") ? "flex" : "none"}
// hidden={checkModule(permissions, "users") ? "flex" : "none"}
key="Verificarsindicalizado"
text="VERIFICAR SINDICALIZADO"
onClick={() => {
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Protected/Benefit/Benefits/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Benefits = () => {
const navigate = useNavigate();
const { user } = useAuth();
const permissions = usePermissions();
const canCreate = checkAction(permissions, "benefits", "create");
const canCreate = checkAction(permissions, "create");

const handleBenefitsList = () => {
navigate("/beneficios/lista");
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Protected/Benefit/BenefitsList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function BenefitsList() {
const [benefits, setBenefits] = useState([]);
const navigate = useNavigate();
const permissions = usePermissions();
const canCreate = checkAction(permissions, "benefits", "create");
const canCreate = checkAction(permissions, "create");

const handleSubmit = () => {
navigate("/beneficios/criar");
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Protected/Benefit/BenefitsUpdate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export default function BenefitsUpdate() {
const [showDeletedModal, setShowDeletedModal] = useState(false);
const [openError, setOpenError] = useState(false);
const permissions = usePermissions();
const canUpdate = checkAction(permissions, "benefits", "update");
const canDelete = checkAction(permissions, "benefits", "delete");
const canUpdate = checkAction(permissions,"update");
const canDelete = checkAction(permissions, "delete");

const tipoPessoaList = ["Jurídica", "Física"];
const categoriaList = [
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Protected/Finance/BankAccountList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function ListBankAccount() {
const { user } = useAuth();
const [bankAccounts, setBankAccounts] = useState([]);
const permissions = usePermissions();
const canCreate = checkAction(permissions, "finance", "create");
const canCreate = checkAction(permissions, "create");

useEffect(() => {
const fetchBankAccounts = async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Protected/Finance/BankAccountUpdate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const BankAccountId = () => {
const [agency, setAgency] = useState("");
const [openError, setOpenError] = useState(false);
const permissions = usePermissions();
const canUpdate = checkAction(permissions, "finance", "update");
const canDelete = checkAction(permissions, "finance", "delete");
const canUpdate = checkAction(permissions, "update");
const canDelete = checkAction(permissions, "delete");

const { user } = useAuth();
const { id } = useParams(); // Pega o ID da URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function FinancialList() {
const [dataInicio, setDataInicio] = useState(null);
const [dataFinal, setDataFinal] = useState(null);
const permissions = usePermissions();
const canCreate = checkAction(permissions, "finance", "create");
const canCreate = checkAction(permissions, "create");

const storagedUser = JSON.parse(localStorage.getItem("@App:user"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default function FinancialUpdate() {
const [nomesDestino, setNomesDestino] = useState([]);
const maxDescricaoLength = 130;
const permissions = usePermissions();
const canUpdate = checkAction(permissions, "finance", "update");
const canDelete = checkAction(permissions, "finance", "delete");
const canUpdate = checkAction(permissions, "update");
const canDelete = checkAction(permissions, "delete");

const navigate = useNavigate();
const location = useLocation();
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Protected/Organ/ListOrgan/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function OrganList() {
const [organs, setOrgans] = useState([]);
const navigate = useNavigate();

const canCreate = checkAction(permissions, "users", "create");
const canCreate = checkAction(permissions,"create");
useEffect(() => {
const getOrgansInfo = async () => {
const response = await listOrgans();
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Protected/Organ/OrganUpdate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const OrganId = () => {
const organsId = state?.organsId;
const navigate = useNavigate();
const permissions = usePermissions();
const canUpdate = checkAction(permissions, "users", "update");
const canDelete = checkAction(permissions, "users", "delete");
const canUpdate = checkAction(permissions, "update");
const canDelete = checkAction(permissions, "delete");

const [openSave, setOpenSave] = useState(false);
const [openDeleteOrgan, setOpenDeleteOrgan] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Protected/Roles/RolesListPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function RolesListPage() {
fetchRoleForm();
}, []);

const hasPermission = checkAction(permissions, "users", "create");
const hasPermission = checkAction(permissions, "create");

const handleSubmit = () => {
navigate("/perfis/criar");
Expand Down
51 changes: 51 additions & 0 deletions src/Pages/Protected/Roles/RolesUpdatePage/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.permission-filter-box {
margin-top: 20px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
}

.permission-actions {
display: flex;
gap: 10px;
margin-bottom: 15px;
}


.permissions-list {
max-height: 300px;
overflow-y: auto;
border: 1px solid #ccc;
padding: 10px;
border-radius: 4px;
background: white;
}

.permission-item {
display: flex;
align-items: center;
margin-bottom: 8px;
}

.permission-label {
font-size: 14px;
margin-left: 8px;
}

.permission-checkbox {
transform: scale(1.2);
}

.search-box {
margin-bottom: 15px;
}

.search-box input {
width: 100%;
padding: 8px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 4px;
outline: none;
}
Loading

0 comments on commit 8747f65

Please sign in to comment.