From e905b644235259feafad1bfd873c3d712854658e Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Thu, 10 Jan 2019 16:18:08 +0100 Subject: [PATCH] bugfix le toggle de la section ldap-authentified --- README.md | 2 +- database/update/db-update-2019-01-09-CRAL.sh | 6 +++--- database/update/db-update-2019-01-09.sh | 6 +++--- database/update/db-update-2019-01-10-IRAP-TEST-only.sh | 40 ++++++++++++++++++++++++++++++++++++++++ database/update/db-update-2019-01-10-IRAP.sh | 40 ---------------------------------------- database/update/script_sql/db-update-2019-01-10-IRAP-TEST-only.sql | 4 ++++ database/update/script_sql/db-update-2019-01-10-IRAP.sql | 4 ---- src/Template/Configurations/edit.ctp | 6 ++++-- webroot/js/script.js | 11 +++++++++-- 9 files changed, 64 insertions(+), 55 deletions(-) create mode 100755 database/update/db-update-2019-01-10-IRAP-TEST-only.sh delete mode 100755 database/update/db-update-2019-01-10-IRAP.sh create mode 100755 database/update/script_sql/db-update-2019-01-10-IRAP-TEST-only.sql delete mode 100755 database/update/script_sql/db-update-2019-01-10-IRAP.sql diff --git a/README.md b/README.md index d6be17b..df26994 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Logiciel testé et validé sur les configurations suivantes : VERSION ACTUELLE Date: 10/01/2019 -Version: 2.9.1.8 +Version: 2.9.1.9 Author: EP Ajout du mode ldap authentifié : - Attention, modif de la BD, il faut executer le script db-update-2019-01-09.sh ("-CRAL.sh" pour le CRAL) diff --git a/database/update/db-update-2019-01-09-CRAL.sh b/database/update/db-update-2019-01-09-CRAL.sh index bb5ae63..0762cbe 100755 --- a/database/update/db-update-2019-01-09-CRAL.sh +++ b/database/update/db-update-2019-01-09-CRAL.sh @@ -30,9 +30,9 @@ cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql -# Delete cakephp cache -sudo rm ../../tmp/cache/models/* -sudo rm ../../tmp/cache/persistent/* +# Delete cakephp cache (-f avoids warning if no file) +sudo rm -f ../../tmp/cache/models/* +sudo rm -f ../../tmp/cache/persistent/* # Faire ca aussi si ca suffit pas... #sudo chmod -R 777 ../../tmp diff --git a/database/update/db-update-2019-01-09.sh b/database/update/db-update-2019-01-09.sh index 0048691..6ef2f61 100755 --- a/database/update/db-update-2019-01-09.sh +++ b/database/update/db-update-2019-01-09.sh @@ -30,9 +30,9 @@ cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql -# Delete cakephp cache -sudo rm ../../tmp/cache/models/* -sudo rm ../../tmp/cache/persistent/* +# Delete cakephp cache (-f avoids warning if no file) +sudo rm -f ../../tmp/cache/models/* +sudo rm -f ../../tmp/cache/persistent/* # Faire ca aussi si ca suffit pas... #sudo chmod -R 777 ../../tmp diff --git a/database/update/db-update-2019-01-10-IRAP-TEST-only.sh b/database/update/db-update-2019-01-10-IRAP-TEST-only.sh new file mode 100755 index 0000000..6ef2f61 --- /dev/null +++ b/database/update/db-update-2019-01-10-IRAP-TEST-only.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +#myname=`basename $0 .sh` +myname=`basename $0` +myname=${myname%%.*} + +# Pour Mac OS recent (10.10, Yosemite), la syntaxe du SED est differente +# Il faut donc faire une copie de ce fichier et transformer les instructions sed a l'interieur +# Pour cela, il suffit d'executer ces 2 lignes : +# cp ce_script.sh ce_script_macosx.sh +# sed -e "s/ -i / -i '' /" -i '' ce_script_macosx.sh + +if [ ! -f ../../config/app.php ] ; then +echo "Vous devez executer ce script depuis le dossier database/update/" +exit 1 +fi + + +# Get login, pass, dbname, and hostname +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) + + +#cp -p ./script_sql/db-update-2016-07-01-irap.sql ./script_sql/db-update-2016-07-01-irap-build.sql +cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql + +# Execute sql update script +sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql +mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql + +# Delete cakephp cache (-f avoids warning if no file) +sudo rm -f ../../tmp/cache/models/* +sudo rm -f ../../tmp/cache/persistent/* + +# Faire ca aussi si ca suffit pas... +#sudo chmod -R 777 ../../tmp +#sudo chmod -R 777 ../../vendor +#sudo chmod -R 777 ../../webroot \ No newline at end of file diff --git a/database/update/db-update-2019-01-10-IRAP.sh b/database/update/db-update-2019-01-10-IRAP.sh deleted file mode 100755 index 0048691..0000000 --- a/database/update/db-update-2019-01-10-IRAP.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -#myname=`basename $0 .sh` -myname=`basename $0` -myname=${myname%%.*} - -# Pour Mac OS recent (10.10, Yosemite), la syntaxe du SED est differente -# Il faut donc faire une copie de ce fichier et transformer les instructions sed a l'interieur -# Pour cela, il suffit d'executer ces 2 lignes : -# cp ce_script.sh ce_script_macosx.sh -# sed -e "s/ -i / -i '' /" -i '' ce_script_macosx.sh - -if [ ! -f ../../config/app.php ] ; then -echo "Vous devez executer ce script depuis le dossier database/update/" -exit 1 -fi - - -# Get login, pass, dbname, and hostname -username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) -password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) -database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) -host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) - - -#cp -p ./script_sql/db-update-2016-07-01-irap.sql ./script_sql/db-update-2016-07-01-irap-build.sql -cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql - -# Execute sql update script -sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql -mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql - -# Delete cakephp cache -sudo rm ../../tmp/cache/models/* -sudo rm ../../tmp/cache/persistent/* - -# Faire ca aussi si ca suffit pas... -#sudo chmod -R 777 ../../tmp -#sudo chmod -R 777 ../../vendor -#sudo chmod -R 777 ../../webroot \ No newline at end of file diff --git a/database/update/script_sql/db-update-2019-01-10-IRAP-TEST-only.sql b/database/update/script_sql/db-update-2019-01-10-IRAP-TEST-only.sql new file mode 100755 index 0000000..0e65b63 --- /dev/null +++ b/database/update/script_sql/db-update-2019-01-10-IRAP-TEST-only.sql @@ -0,0 +1,4 @@ +use database; + +ALTER TABLE `configurations` CHANGE `ldap_anonymous` `ldap_authentified` BOOLEAN NOT NULL DEFAULT FALSE AFTER `ldap_filter`; +update configurations set ldap_authentified = FALSE; diff --git a/database/update/script_sql/db-update-2019-01-10-IRAP.sql b/database/update/script_sql/db-update-2019-01-10-IRAP.sql deleted file mode 100755 index 1174000..0000000 --- a/database/update/script_sql/db-update-2019-01-10-IRAP.sql +++ /dev/null @@ -1,4 +0,0 @@ -use database; - -ALTER TABLE `configurations` CHANGE `anonymous_ldap` `ldap_authentified` BOOLEAN NOT NULL DEFAULT FALSE AFTER `ldap_filter`; -update configurations set ldap_authentified = FALSE; diff --git a/src/Template/Configurations/edit.ctp b/src/Template/Configurations/edit.ctp index 3b69b71..4ad7ac3 100644 --- a/src/Template/Configurations/edit.ctp +++ b/src/Template/Configurations/edit.ctp @@ -161,9 +161,11 @@ /*MCM*/ // start LDAP auth subsection (DIV) echo $this->Form->input('ldap_authentified', [ + //'id' => 'ldap-authentified', 'label' => 'LDAP authentifié (non anonyme)', - 'onchange' => 'display_ldap_auth();' - ]); + //'onchange' => 'display_ldap_auth();' + 'onchange' => 'toggle_ldap_auth();' + ]); echo '
'; echo $this->Form->input('ldap_bindDn', [ 'label' => 'Bind du LDAP' diff --git a/webroot/js/script.js b/webroot/js/script.js index b918bda..a6adf92 100755 --- a/webroot/js/script.js +++ b/webroot/js/script.js @@ -104,9 +104,16 @@ function emprunt_interne_externe() { function display_ldap() { $('#ldap').toggle(); + toggle_ldap_auth(); } -function display_ldap_auth() { - $('#ldap_auth').toggle(); +function toggle_ldap_auth() { + //$('#ldap_auth').toggle(); + document.getElementById("ldap_auth").style.display = document.getElementById("ldap-authentified").checked ? "block":"none"; + /* + var ldap_auth_div = document.getElementById("ldap_auth"); + var ldap_auth_checkbox = document.getElementById("ldap-authentified"); + ldap_auth_div.style.display = ldap_auth_checkbox.checked ? "block":"none"; + */ } function selectAll() { -- libgit2 0.21.2