1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cheky_ynh.git synced 2024-09-03 18:16:00 +02:00

[autopatch] Autopatch to migrate to new permission system

This commit is contained in:
Yunohost-Bot 2021-03-15 00:25:32 +01:00 committed by Alexandre Aubin
parent ee9a1c83c8
commit 2669aec53e
2 changed files with 19 additions and 7 deletions

View file

@ -59,7 +59,6 @@ ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app password $password
ynh_app_setting_set $app is_public $is_public
#=================================================
@ -140,7 +139,7 @@ chown -R $app: $final_path
# Set the app as temporarily public for curl call
ynh_print_info "Configuring SSOwat..."
ynh_app_setting_set $app skipped_uris "/"
# Reload SSOwat config
yunohost app ssowatconf
@ -154,9 +153,11 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$password" "type=db" "db[host]=localhost" "db[user]=$db_name" "db[password]=$db_pwd" "db[dbname]=$db_name"
# Remove the public access
if [ $is_public -eq 0 ]
# Make app public if necessary
if [ "$is_public" -eq 1 ]
then
ynh_app_setting_delete $app skipped_uris
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
@ -177,11 +178,12 @@ chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sau
#=================================================
ynh_print_info "Configuring SSOwat..."
# Make app public if necessary
if [ $is_public -eq 1 ]
if [ "$is_public" -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -63,6 +63,16 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# Migrate legacy permissions to new system
#=================================================
if ynh_legacy_permissions_exists
then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CHECK THE PATH
#=================================================