1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00

Use SSO in private AND public mode. In public mode, the user will be authenticated if logged in Yunohost portal. Depending of piwigo configuration, the user could otherwise log in as a guest, or via a specific piwigo-only account.

This commit is contained in:
Jimmy Monin 2016-09-07 07:23:00 +02:00
parent 0cb4536a02
commit 9d624bf772
3 changed files with 12 additions and 9 deletions

View file

@ -1,8 +1,10 @@
<?php <?php
/* Dans cette fenêtre, écrivez les informations pour configurer votre galerie Piwigo. */ // Use HTTP authentication
$conf['apache_authentication'] = true; $conf['apache_authentication'] = true;
// Use external authentication
$conf['external_authentification'] = true;
?> ?>

View file

@ -8,7 +8,7 @@ location PATHTOCHANGE {
fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user if_not_empty;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }

View file

@ -69,7 +69,7 @@ sudo chmod 755 -R $final_path/galleries
# Reload Nginx and regenerate SSOwat conf # Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload
sudo yunohost app setting piwigo skipped_uris -v "/" sudo yunohost app setting piwigo unprotected_uris -v "/"
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Generate random password for admin # Generate random password for admin
@ -79,7 +79,10 @@ adm_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9'
#configure piwigo via curl #configure piwigo via curl
echo "127.0.0.1 $domain #yunopiwigo" | sudo tee -a /etc/hosts echo "127.0.0.1 $domain #yunopiwigo" | sudo tee -a /etc/hosts
sleep 2 sleep 2
curl -kL -X POST https://$domain$path/install.php?language=fr_FR --data "install=true&dbuser=$db_user&dbpasswd=$db_pwd&dbname=$db_user&admin_name=$user&admin_pass1=$adm_pwd&admin_pass2=$adm_pwd&admin_mail=webmaster@$domain" > /home/admin/test curl -kL -X POST https://$domain$path/install.php?language=fr_FR --data "install=true&dbuser=$db_user&dbpasswd=$db_pwd&dbname=$db_user&admin_name=$user&admin_pass1=$adm_pwd&admin_pass2=$adm_pwd&admin_mail=webmaster@$domain" > /home/yunohost.app/piwigo/piwigo-install.log
#Change local config
sudo cp ../conf/config.inc.php $final_path/local/config/
#change variable in local/config/database.inc.php #change variable in local/config/database.inc.php
@ -94,12 +97,10 @@ sudo cp ../conf/database.inc.php $final_path/local/config/database.inc.php
mysql -u $db_user -p$db_pwd $db_user -e "INSERT INTO plugins (id,state,version) VALUES ('Ldap_Login','active','1.1');" mysql -u $db_user -p$db_pwd $db_user -e "INSERT INTO plugins (id,state,version) VALUES ('Ldap_Login','active','1.1');"
#protect URIs #protect URIs
if [ $is_public = "No" ]; if [ $is_public = "No" ];
then then
sudo cp ../conf/config.inc.php $final_path/local/config/ sudo yunohost app setting piwigo protected_uris -v "/"
sudo yunohost app setting piwigo protected_uris -v "/" sudo yunohost app ssowatconf
sudo yunohost app ssowatconf
fi fi
# Remove temporary entry in /etc/hosts # Remove temporary entry in /etc/hosts