From a173b40577305b6646389fcc165c9c4d47d6c895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 23 Jan 2024 23:54:37 +0100 Subject: [PATCH] fix upgrade, restore --- manifest.toml | 15 +++++++++------ scripts/restore | 3 --- scripts/upgrade | 13 ++++++++++++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2511b6d..73e41e8 100644 --- a/manifest.toml +++ b/manifest.toml @@ -37,6 +37,12 @@ ram.runtime = "50M" type = "path" default = "/poll" + [install.init_main_permission] + # this is a generic question - ask strings are automatically handled by YunoHost's core + # This won't be saved as setting and will instead be used to initialize the SSOwat permission + type = "group" + default = "visitors" + [install.language] ask.en = "Choose the default language of this LimeSurvey" ask.fr = "Choisissez la langue par défault de LimeSurvey" @@ -50,12 +56,6 @@ ram.runtime = "50M" [install.password] type = "password" - [install.is_admin_public] - ask.en = "In private mode, only authorized YunoHost members can create poll, with the public mode, it's possible to create account to people with no YunoHost account. " - ask.fr = "En mode privé, seuls les utilisateurs YunoHost autorisés peuvent créer un sondage. En mode public, il est possible de créer un sondage avec un compte Limesurvey mais sans compte YunoHost." - type = "boolean" - default = true - [resources] [resources.sources] [resources.sources.main] @@ -80,6 +80,8 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + admin.url = "/admin" + admin.allowed = "admin" [resources.apt] packages = [ @@ -92,6 +94,7 @@ ram.runtime = "50M" "php7.4-ldap", "php7.4-zip", "php7.4-mbstring", + "mariadb-server", ] [resources.database] diff --git a/scripts/restore b/scripts/restore index 45343fe..f5d7be1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,9 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -ynh_secure_remove "$install_dir/upload" -ln -s "$data_dir/upload" "$install_dir/upload" - chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index b5b5a1a..62e311c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,13 +33,24 @@ if [ ! -L "$install_dir/upload" ]; then mv "$install_dir/upload" "$data_dir/upload" fi +# Legacy permission setting +if [ -z "${is_admin_public:-}" ]; then + if [ "$is_admin_public" -eq 1 ]; then + ynh_permission_update --permission="admin" --add="visitors" + fi + ynh_app_setting_delete --app="$app" --key=is_admin_public +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="plugins/ application/config/config.php upload" +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="plugins/ application/config/config.php" + +ynh_secure_remove --file="$install_dir/upload" +ln -s "$data_dir/upload" "$install_dir/upload" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir"