Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gildeluermoz committed Nov 17, 2016
2 parents 6cf7427 + 3e5b87d commit 760a2ec
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 27 deletions.
8 changes: 5 additions & 3 deletions data/create_utilisateurs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ INSERT INTO utilisateurs.bib_unites (nom_unite, adresse_unite, cp_unite, ville_u
INSERT INTO utilisateurs.bib_unites (nom_unite, adresse_unite, cp_unite, ville_unite, tel_unite, fax_unite, email_unite, id_unite) VALUES ('Partenaire fournisseur', NULL, NULL, NULL, NULL, NULL, NULL, 10);
INSERT INTO utilisateurs.bib_unites (nom_unite, adresse_unite, cp_unite, ville_unite, tel_unite, fax_unite, email_unite, id_unite) VALUES ('Autres', NULL, NULL, NULL, NULL, NULL, NULL, 99);

INSERT INTO utilisateurs.t_applications (id_application, nom_application, desc_application) VALUES (1, 'Taxhub', 'application permettant d''administrer la liste des taxons.');
INSERT INTO t_applications (id_application, nom_application, desc_application) VALUES (1, 'application utilisateurs', 'application permettant d''administrer les utilisateurs.');
INSERT INTO utilisateurs.t_applications (id_application, nom_application, desc_application) VALUES (2, 'Taxhub', 'application permettant d''administrer la liste des taxons.');
INSERT INTO utilisateurs.t_applications (id_application, nom_application, desc_application) VALUES (14, 'application GeoNature', 'Application permettant la consultation et la gestion des relevés faune et flore.');

INSERT INTO utilisateurs.t_roles (groupe, id_role, identifiant, nom_role, prenom_role, desc_role, pass, email, organisme, id_unite, pn, session_appli, date_insert, date_update, id_organisme, remarques) VALUES (true, 20002, NULL, 'grp_en_poste', NULL, 'Tous les agents en poste', NULL, NULL, 'monpn', 99, true, NULL, NULL, NULL, NULL,'groupe test');
Expand All @@ -260,8 +261,9 @@ INSERT INTO utilisateurs.t_roles (groupe, id_role, identifiant, nom_role, prenom
INSERT INTO utilisateurs.t_roles (groupe, id_role, identifiant, nom_role, prenom_role, desc_role, pass, email, organisme, id_unite, pn, session_appli, date_insert, date_update, id_organisme, remarques) VALUES (false, 2, 'agent', 'Agent', 'test', NULL, 'b33aed8f3134996703dc39f9a7c95783', '', 'Parc national des Ecrins', 1, true, NULL, NULL, NULL, 99,'utilisateur test à modifier ou supprimer');

INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (1, 6, 1);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (20002, 3, 14);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (1, 6, 2);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (1, 6, 14);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (20002, 3, 14);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (2, 2, 14);
INSERT INTO utilisateurs.cor_role_droit_application (id_role, id_droit, id_application) VALUES (3, 1, 14);

Expand All @@ -272,4 +274,4 @@ INSERT INTO utilisateurs.cor_role_menu (id_role, id_menu) VALUES (20002, 10);
INSERT INTO utilisateurs.cor_role_menu (id_role, id_menu) VALUES (20002, 9);

INSERT INTO cor_roles (id_role_groupe, id_role_utilisateur) VALUES (20002, 1);
INSERT INTO cor_roles (id_role_groupe, id_role_utilisateur) VALUES (20002, 2);
INSERT INTO cor_roles (id_role_groupe, id_role_utilisateur) VALUES (20002, 2);
5 changes: 5 additions & 0 deletions data/grant.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER SCHEMA utilisateurs OWNER TO $usershub_user;
ALTER FOREIGN TABLE utilisateurs.t_applications OWNER TO $usershub_user;
ALTER FOREIGN TABLE utilisateurs.t_roles OWNER TO $usershub_user;
ALTER FOREIGN TABLE utilisateurs.v_userslist_forall_applications OWNER TO $usershub_user;
ALTER FOREIGN TABLE utilisateurs.v_userslist_forall_menu OWNER TO $usershub_user;
31 changes: 18 additions & 13 deletions data/inpn/data_inpn_v9_taxhub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,17 @@ DELIMITER ';' encoding 'LATIN1';

---import des statuts de protections associés au taxon
CREATE TABLE import_protection_especes (
CD_NOM int,
CD_PROTECTION varchar(250),
NOM_CITE text,
SYN_CITE text,
NOM_FRANCAIS_CITE text,
PRECISIONS varchar(500),
CD_NOM_CITE int
cd_nom int,
cd_protection varchar(250),
nom_cite text,
syn_cite text,
nom_francais_cite text,


precisions varchar(500),
cd_nom_cite int


);

COPY import_protection_especes
Expand Down Expand Up @@ -223,9 +227,10 @@ WHERE cd_protection IN (
--- Activation des textes valides pour la structure
-- Par défaut activation de tous les textes nationaux et internationaux
-- Pour des considérations locales à faire au cas par cas !!!
UPDATE taxonomie.taxref_protection_articles SET concerne_mon_territoire = true
WHERE cd_protection IN (
SELECT cd_protection
FROM taxonomie.taxref_protection_articles
WHERE type_protection = 'Protection'
);
--UPDATE taxonomie.taxref_protection_articles SET concerne_mon_territoire = true
--WHERE cd_protection IN (
--SELECT cd_protection
--FROM taxonomie.taxref_protection_articles
--WHERE type_protection = 'Protection'
--);

2 changes: 1 addition & 1 deletion data/taxhubdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ INSERT INTO bib_themes (id_theme, nom_theme, desc_theme, ordre, id_droit) VALUES
-- Name: bib_themes_id_theme_seq; Type: SEQUENCE SET; Schema: taxonomie; Owner: dbadmin
--

SELECT pg_catalog.setval('bib_themes_id_theme_seq', 3, true);
SELECT pg_catalog.setval('bib_themes_id_theme_seq', 4, true);



Expand Down
8 changes: 8 additions & 0 deletions data/taxhubdata_taxon_example.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,28 @@ INSERT INTO bib_noms (id_nom, cd_nom, cd_ref, nom_francais) VALUES (100002, 9518

INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (67111, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (67111, 2, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (67111, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (60612, 1, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (60612, 2, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (60612, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (351, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (351, 2, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (351, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (8326, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (8326, 2, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (8326, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (11165, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (11165, 2, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (11165, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (18437, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (18437, 2, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (18437, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (81065, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (81065, 2, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (81065, 3, 'oui');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (95186, 1, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (95186, 2, 'non');
INSERT INTO cor_taxon_attribut (cd_ref ,id_attribut, valeur_attribut) VALUES (95186, 3, 'oui');


--
Expand Down
8 changes: 8 additions & 0 deletions data/taxhubdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,14 @@ ALTER TABLE ONLY cor_nom_liste
ADD CONSTRAINT cor_nom_liste_pkey PRIMARY KEY (id_nom, id_liste);


--
-- Name: cor_taxon_attribut_pkey; Type: CONSTRAINT; Schema: taxonomie; Owner: -; Tablespace:
--

ALTER TABLE taxonomie.cor_taxon_attribut
ADD CONSTRAINT cor_taxon_attribut_pkey PRIMARY KEY(id_attribut, cd_ref);


--
-- TOC entry 3393 (class 2606 OID 239037)
-- Name: id; Type: CONSTRAINT; Schema: taxonomie; Owner: -; Tablespace:
Expand Down
2 changes: 1 addition & 1 deletion install_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cd ..
#Installation du virtual env
echo "Installation du virtual env..."
virtualenv venv
virtualenv -p $python_path venv #TODO adapater le chemin à la version de python du server
virtualenv -p sr/bin/python2.7 venv #TODO adapater le chemin à la version de python du server
source venv/bin/activate
pip install -r requirements.txt
deactivate
Expand Down
8 changes: 6 additions & 2 deletions install_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ then

echo "Insertion des données taxonomiques de l'inpn... (cette opération peut être longue)"
cd $DIR
export PGPASSWORD=$admin_pg_pass;psql -h $db_host -U $admin_pg -d $db_name -f data/inpn/data_inpn_v9_taxhub.sql &>> logs/install_db.log
sudo -n -u postgres -s psql -d $db_name -f data/inpn/data_inpn_v9_taxhub.sql &>> logs/install_db.log

echo "Création de la vue représentant la hierarchie taxonomique..."
export PGPASSWORD=$user_pg_pass;psql -h $db_host -U $user_pg -d $db_name -f data/vm_hierarchie_taxo.sql &>> logs/install_db.log
Expand All @@ -71,17 +71,21 @@ then
else
echo "Connexion à la base Utilisateur..."
cp data/create_fdw_utilisateurs.sql /tmp/create_fdw_utilisateurs.sql
cp data/grant.sql /tmp/grant.sql
sed -i "s#\$user_pg#$user_pg#g" /tmp/create_fdw_utilisateurs.sql
sed -i "s#\$usershub_host#$usershub_host#g" /tmp/create_fdw_utilisateurs.sql
sed -i "s#\$usershub_db#$usershub_db#g" /tmp/create_fdw_utilisateurs.sql
sed -i "s#\$usershub_port#$usershub_port#g" /tmp/create_fdw_utilisateurs.sql
sed -i "s#\$usershub_user#$usershub_user#g" /tmp/create_fdw_utilisateurs.sql
sed -i "s#\$usershub_pass#$usershub_pass#g" /tmp/create_fdw_utilisateurs.sql
export PGPASSWORD=$admin_pg_pass;psql -h $db_host -U $admin_pg -d $db_name -f /tmp/create_fdw_utilisateurs.sql &>> logs/install_db.log
sed -i "s#\$usershub_user#$usershub_user#g" /tmp/grant.sql
sudo -n -u postgres -s psql -d $db_name -f /tmp/create_fdw_utilisateurs.sql &>> logs/install_db.log
sudo -n -u postgres -s psql -d $db_name -f /tmp/grant.sql &>> logs/install_db.log
fi

# suppression des fichiers : on ne conserve que les fichiers compressés
echo "nettoyage..."
rm /tmp/*.txt
rm /tmp/*.csv
rm /tmp/*.sql
fi
6 changes: 0 additions & 6 deletions settings.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@ db_name=taxhubdb
#nom de l'utilisateur propriétaire de la base PostgreSQL
user_pg=geonatuser

#nom du superutilisateur PostgreSQL
admin_pg=geonatadmin

#user propriétaire de la base geonaturedb
user_pg_pass=monpassachanger

#superuser de la base geonaturedb
admin_pg_pass=monpassachanger

#config Python
#Python3 est requis

Expand Down
2 changes: 1 addition & 1 deletion static/app/constants.js.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app.constant("backendCfg", {
"api_url": "api/",
"medias_path": "static/medias/",
"id_application": "1",
"id_application": "2",
"user_admin_privilege":6,
"user_high_privilege":4,
"user_medium_privilege":3,
Expand Down

0 comments on commit 760a2ec

Please sign in to comment.