1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/humhub_ynh.git synced 2024-09-03 19:26:11 +02:00

Improve upgrade of sso module

This commit is contained in:
Sébastien Mennetrier 2022-05-18 15:24:23 +02:00
parent a9a005adf7
commit bc929c23a6
3 changed files with 11 additions and 8 deletions

View file

@ -73,16 +73,13 @@ myynh_urlencode() {
return 0
}
enable_sso() {
install_sso() {
tmp_auth_basic_module="$(mktemp /tmp/humhub_ynh.XXXXXX)"
wget -q -O $tmp_auth_basic_module "https://github.com/smart4life/humhub-auth-basic/archive/refs/tags/$HUMHUB_AUTH_BASIC_VERSION.tar.gz"
tar xf $tmp_auth_basic_module -C $final_path/protected/modules
mv $final_path/protected/modules/humhub-auth-basic* $final_path/$HUMHUB_AUTH_BASIC_PATH
pushd $final_path/protected/
php${YNH_PHP_VERSION} yii module/enable auth-basic
popd
ynh_secure_remove $tmp_auth_basic_module
}

View file

@ -136,6 +136,8 @@ ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=2
install_sso
pushd $final_path/protected
php${YNH_PHP_VERSION} yii migrate/up --includeModuleMigrations=1 --interactive=0
@ -173,9 +175,9 @@ pushd $final_path/protected
php${YNH_PHP_VERSION} yii settings/set user auth.allowGuestAccess '0'
php${YNH_PHP_VERSION} yii settings/set user auth.internalUsersCanInvite '0'
popd
php${YNH_PHP_VERSION} yii module/enable auth-basic
enable_sso
popd
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"

View file

@ -86,12 +86,16 @@ then
ynh_secure_remove --file="$final_path.old"
if [[ ! -d $final_path/$HUMHUB_AUTH_BASIC_PATH ]]; then
enable_sso
install_sso
pushd $final_path/protected
php${YNH_PHP_VERSION} yii module/enable auth-basic
popd
else
current_version=$(cat $final_path/$HUMHUB_AUTH_BASIC_PATH/module.json | jq -j '.version')
if [ "$current_version" != "$HUMHUB_AUTH_BASIC_VERSION" ]; then
ynh_secure_remove $final_path/$HUMHUB_AUTH_BASIC_PATH
enable_sso
install_sso
fi
fi
fi