From 02d2ff92097e6893c7c45d7a6a1ce4fff9ac5b65 Mon Sep 17 00:00:00 2001 From: Florian d'Erfurth Date: Wed, 24 Apr 2024 15:28:36 +0200 Subject: [PATCH] Ajoute les tests de droits des tables. --- data_layer/seed/test/89-4_matrices.sql | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 data_layer/seed/test/89-4_matrices.sql diff --git a/data_layer/seed/test/89-4_matrices.sql b/data_layer/seed/test/89-4_matrices.sql new file mode 100644 index 0000000000..1407696865 --- /dev/null +++ b/data_layer/seed/test/89-4_matrices.sql @@ -0,0 +1,81 @@ +create type test.crud_element as +( + kind confidentialite_type_element, + name text +); + +-- todo on devrait nommer les matrices avec le métier. +do +$$ + declare + disallowed_for_all test.crud_element[] = array + [ + -- Panier d'action: ces tables servent à sauvegarder des données lors de la creation du plan + ('table', 'action_impact_fiche_action'), + ('table', 'action_impact_effet_attendu') + ]; + crud_for_all test.crud_element[] = array + [ + -- Panier d'action: tout le monde peut tout faire sur le panier + ('table', 'panier'), + ('table', 'action_impact_panier'), + ('table', 'action_impact_statut'), + ('table', 'action_impact_state') + ]; + r_for_all test.crud_element[] = array + [ + -- Panier d'action: les tables avec les définitions des actions + ('table', 'action_impact_categorie'), + ('table', 'action_impact_indicateur'), + ('table', 'action_impact_action'), + ('table', 'action_impact_categorie_fnv'), + ('table', 'action_impact_banatic_competence'), + ('table', 'action_impact_sous_thematique'), + ('table', 'action_impact_thematique'), + ('table', 'action_impact'), + ('table', 'effet_attendu'), + ('table', 'action_impact_temps_de_mise_en_oeuvre'), + ('table', 'action_impact_fourchette_budgetaire'), + ('table', 'action_impact_complexite'), + ('table', 'categorie_fnv') + ]; + curr_element test.crud_element; + begin + foreach curr_element in array disallowed_for_all + loop + insert into confidentialite_crud (type_element, nom_element, profil, c, r, u, d) + values ('table', curr_element.name, 'public', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'connecte', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'verifie', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'support', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'lecture', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'edition', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'admin', 'non', 'non', 'non', 'non'), + ('table', curr_element.name, 'auditeur', 'non', 'non', 'non', 'non'); + end loop; + foreach curr_element in array crud_for_all + loop + insert into confidentialite_crud (type_element, nom_element, profil, c, r, u, d) + values ('table', curr_element.name, 'public', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'connecte', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'verifie', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'support', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'lecture', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'edition', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'admin', 'oui', 'oui', 'oui', 'oui'), + ('table', curr_element.name, 'auditeur', 'oui', 'oui', 'oui', 'oui'); + end loop; + foreach curr_element in array r_for_all + loop + insert into confidentialite_crud (type_element, nom_element, profil, c, r, u, d) + values ('table', curr_element.name, 'public', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'connecte', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'verifie', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'support', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'lecture', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'edition', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'admin', 'non', 'oui', 'non', 'non'), + ('table', curr_element.name, 'auditeur', 'non', 'oui', 'non', 'non'); + end loop; + end +$$;