mirror of
https://github.com/YunoHost-Apps/spip_ynh.git
synced 2024-09-03 20:25:59 +02:00
Ajout l'utilisation de LDAP
This commit is contained in:
parent
4d3c32d1e2
commit
dc578361b7
7 changed files with 51 additions and 19 deletions
|
@ -10,6 +10,7 @@ Source: [spip.net](http://www.spip.net/fr_rubrique91.html)
|
|||
|
||||
- Installation de la base sans passer par le système d'installation
|
||||
- Support multilingue
|
||||
- Support LDAP
|
||||
|
||||
### Installation
|
||||
|
||||
|
@ -45,9 +46,14 @@ Request a "forgotten password" to change your password, you will receive an emai
|
|||
|
||||
- Database install without going through the system install
|
||||
- Multilanguage support
|
||||
- LDAP support
|
||||
|
||||
## Versionning
|
||||
|
||||
### Version 1.1.4 (05/03/17)
|
||||
|
||||
- Support LDAP
|
||||
|
||||
### Version 1.1.3 (22/02/17)
|
||||
|
||||
- Update scripts for passing package_linter
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=0
|
||||
Level 4=1
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if (!defined("_ECRIRE_INC_VERSION")) return;
|
||||
$GLOBALS['spip_connect_version'] = 0.8;
|
||||
spip_connect_db('localhost','','__DB_USER__','__DB_PWD__','spip','mysql', 'spip','','');
|
||||
spip_connect_db('localhost','','__DB_USER__','__DB_PWD__','spip','mysql', 'spip','__LDAP__','utf-8');
|
||||
?>
|
7
conf/ldap.php
Normal file
7
conf/ldap.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
if (!defined("_ECRIRE_INC_VERSION")) return;
|
||||
$GLOBALS['ldap_base'] = 'dc=yunohost, dc=org';
|
||||
$GLOBALS['ldap_link'] = @ldap_connect('localhost','389');
|
||||
@ldap_set_option($GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'3');
|
||||
@ldap_bind($GLOBALS['ldap_link'],'dc=yunohost,dc=org','');
|
||||
$GLOBALS['ldap_champs'] = array('login' => array('sAMAccountName','uid','login','userid','cn','sn'),'nom' => 'cn','email' => 'mail','bio' => 'description',);
|
|
@ -6,7 +6,7 @@
|
|||
"en": "SPIP - publishing system for the Internet",
|
||||
"fr": "SPIP - Système de publication pour l’Internet"
|
||||
},
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"url": "http://www.spip.net/",
|
||||
"license": "free",
|
||||
"maintainer": {
|
||||
|
@ -69,6 +69,15 @@
|
|||
},
|
||||
"choices": ["en_EN", "fr_FR"],
|
||||
"default": "fr_FR"
|
||||
},
|
||||
{
|
||||
"name": "ldap",
|
||||
"ask": {
|
||||
"en": "LDAP Connection",
|
||||
"fr": "Connexion LDAP"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "No"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ admin_spip=$YNH_APP_ARG_ADMIN
|
|||
language=$YNH_APP_ARG_LANGUAGE
|
||||
#multisite=$YNH_APP_ARG_MULTISITE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
ldap=$YNH_APP_ARG_LDAP
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -39,6 +40,7 @@ ynh_app_setting_set $app path $path
|
|||
ynh_app_setting_set $app admin $admin_spip
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
ynh_app_setting_set $app language $language
|
||||
ynh_app_setting_set $app ldap $ldap
|
||||
#ynh_app_setting_set $app multisite $multisite
|
||||
|
||||
GENERATE_DB $app # Créer une base de données et un utilisateur dédié au nom de l'app.
|
||||
|
@ -49,7 +51,7 @@ ynh_app_setting_set $app final_path $final_path
|
|||
|
||||
SETUP_SOURCE "spip-3.1.zip"
|
||||
|
||||
# Set permissions to spip directory
|
||||
# Set permissions du répertoire spip
|
||||
sudo chown -R www-data: $final_path
|
||||
|
||||
echo -e "127.0.0.1 $domain #SPIP" | sudo tee -a /etc/hosts
|
||||
|
@ -70,12 +72,12 @@ fi
|
|||
POOL_FPM
|
||||
|
||||
sudo cp ../conf/connect.php $final_path/config/connect.php
|
||||
sudo cp ../conf/mes_options.php $final_path/config/mes_options.php
|
||||
sudo cp ../conf/mes_options.php $final_path/config/mes_options.php
|
||||
|
||||
# Changer les variables du fichier de configuration de SPIP
|
||||
sudo sed -i "s@__DB_USER__@$db_user@g" $final_path/config/connect.php
|
||||
sudo sed -i "s@__DB_PWD__@$db_pwd@g" $final_path/config/connect.php
|
||||
|
||||
# Changer les variables du ficher de configuration de SPIP
|
||||
sudo sed -i "s/__DB_USER__/$db_user/g" $final_path/config/connect.php
|
||||
sudo sed -i "s/__DB_PWD__/$db_pwd/g" $final_path/config/connect.php
|
||||
|
||||
db_md5=$(echo $db_pwd | md5sum | awk '{print $1}')
|
||||
db_sha=$(echo $db_pwd | openssl dgst -sha1 -hmac "key" | awk -F'= ' {'print $2'})
|
||||
language="$(echo $language | head -c 2)"
|
||||
|
@ -105,8 +107,23 @@ done
|
|||
# Charger la structure des tables dans la base.
|
||||
mysql --debug-check -u $db_user -p$db_pwd $db_user < ../conf/sql/spip.sql
|
||||
|
||||
# Donne un accès public pour curl
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
# Utilisation de LDAP pour SPIP
|
||||
if [ "$ldap" = "Yes" ];
|
||||
then
|
||||
sudo cp ../conf/ldap.php $final_path/config/ldap.php
|
||||
sudo sed -i "s/__LDAP__/ldap/g" $final_path/config/connect.php
|
||||
sudo mysql -e "INSERT INTO spip_meta (nom, valeur, impt) VALUES ('ldap_statut_import', '1comite', 'oui');" -u $db_user -p$db_pwd $db_user
|
||||
|
||||
else
|
||||
sudo sed -i "s@__LDAP__@@g" $final_path/config/connect.php
|
||||
fi
|
||||
|
||||
# Setup SSOwat
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
if [ "$is_public" = "Yes" ];
|
||||
then
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
fi
|
||||
|
||||
# Régénère la configuration de SSOwat
|
||||
sudo yunohost app ssowatconf
|
||||
|
@ -115,12 +132,5 @@ sudo yunohost app ssowatconf
|
|||
sudo service php5-fpm restart
|
||||
sudo service nginx reload
|
||||
|
||||
if [ "$is_public" = "No" ];
|
||||
then
|
||||
# Retire l'accès public
|
||||
ynh_app_setting_delete $app unprotected_uris
|
||||
sudo yunohost app ssowatconf
|
||||
fi
|
||||
|
||||
# Nettoyer hosts
|
||||
sudo sed -i '/#SPIP/d' /etc/hosts
|
|
@ -1 +1 @@
|
|||
acc291ee449c6c86eb9276ec1f59f476 spip-3.1.zip
|
||||
2369689c6b387c417ea42506a9ea68b1 spip-3.1.zip
|
||||
|
|
Loading…
Reference in a new issue