Skip to content

Commit

Permalink
Ajoute les tests de droits des tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
derfurth committed Apr 24, 2024
1 parent dcd6dc5 commit 02f51c7
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions data_layer/seed/test/89-4_matrices.sql
Original file line number Diff line number Diff line change
@@ -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
$$;

0 comments on commit 02f51c7

Please sign in to comment.