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

Merge pull request #35 from smart4life/enable-sso

Enable sso
This commit is contained in:
yalh76 2022-07-19 02:57:26 +02:00 committed by GitHub
commit 00cb46741d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View file

@ -8,6 +8,9 @@ YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-apcu-bc php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap" extra_php_dependencies="php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-apcu-bc php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap"
HUMHUB_AUTH_BASIC_VERSION=0.1.0
HUMHUB_AUTH_BASIC_PATH="/protected/modules/auth-basic"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
@ -70,6 +73,16 @@ myynh_urlencode() {
return 0 return 0
} }
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
ynh_secure_remove $tmp_auth_basic_module
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

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

View file

@ -84,6 +84,20 @@ then
# Delete old source # Delete old source
ynh_secure_remove --file="$final_path.old" ynh_secure_remove --file="$final_path.old"
if [[ ! -d $final_path/$HUMHUB_AUTH_BASIC_PATH ]]; then
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
install_sso
fi
fi
fi fi
#================================================= #=================================================