From fbd40de8c0d07dbd801ae6a984f205dbfedf6a25 Mon Sep 17 00:00:00 2001 From: Bertrand Gauthier <bertrand.gauthier@unicaen.fr> Date: Wed, 28 Aug 2019 11:05:45 +0200 Subject: [PATCH] =?UTF-8?q?Script=20SQL=20=C3=A0=20passer=20pour=20install?= =?UTF-8?q?er=20la=20version=201.2.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/SQL/1.2.2/10_fichier_divers.sql | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 data/SQL/1.2.2/10_fichier_divers.sql diff --git a/data/SQL/1.2.2/10_fichier_divers.sql b/data/SQL/1.2.2/10_fichier_divers.sql new file mode 100644 index 000000000..40cb15618 --- /dev/null +++ b/data/SQL/1.2.2/10_fichier_divers.sql @@ -0,0 +1,27 @@ +-- +-- Insertions oubliées dans le script SQL de la version 1.2.1. +-- + +-- Ajout des privilèges fichier-divers/* au profil 'ADMIN_TECH' +insert into PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID) + with data(categ, priv) as ( + select 'fichier-divers', 'televerser' from dual union + select 'fichier-divers', 'telecharger' from dual + ) + select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID + from data + join PROFIL on profil.ROLE_ID in ('ADMIN_TECH') + join CATEGORIE_PRIVILEGE cp on cp.CODE = data.categ + join PRIVILEGE p on p.CATEGORIE_ID = cp.id and p.code = data.priv +/ +-- Attribution (si pas déjà fait) des privilèges fichier-divers/* au rôle 'ADMIN_TECH' (grâce au profil). +insert into ROLE_PRIVILEGE (ROLE_ID, PRIVILEGE_ID) + SELECT r.id as ROLE_ID, p.ID as PRIVILEGE_ID + from PROFIL_PRIVILEGE pp + join profil on PROFIL.ID = pp.PROFIL_ID and profil.ROLE_ID in ('ADMIN_TECH') + join PRIVILEGE p on p.id = pp.PRIVILEGE_ID + join CATEGORIE_PRIVILEGE cp on cp.id = p.CATEGORIE_ID and cp.CODE = 'fichier-divers' + join role r on r.CODE = PROFIL.ROLE_ID + where not exists ( + select * from ROLE_PRIVILEGE rp where rp.ROLE_ID = r.id and rp.PRIVILEGE_ID = p.id + ); -- GitLab