From b37c69ed16b1751c9388c500dd4f0b8875445021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 21 Jan 2023 12:35:07 +0100 Subject: [PATCH] Fix --- conf/config.json.example | 2 +- config_panel.toml | 9 +++++++++ scripts/install | 2 ++ scripts/upgrade | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/conf/config.json.example b/conf/config.json.example index ec92e56..19aadbd 100644 --- a/conf/config.json.example +++ b/conf/config.json.example @@ -10,7 +10,7 @@ "allowFreeURL": __ALLOW_FREE_URL__, "requireFreeURLAuthentication": __REQUIRE_FREE_URL_AUTHENTICATION__, "allowAnonymous": __ALLOW_ANONYMOUS__, - "allowAnonymousEdits": true, + "allowAnonymousEdits": __ALLOW_ANONYMOUS_EDITS__, "defaultPermission": "locked", "email": true, "allowEmailRegister": __ALLOW_EMAIL_REGISTRATION__, diff --git a/config_panel.toml b/config_panel.toml index 9fdb6dd..b56edb0 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -14,6 +14,15 @@ name = "HedgeDoc configuration" help = "Set to allow anonymous usage (default is true)." bind = "allow_anonymous:__FINALPATH__/config.json" + [main.config.allow_anonymous_edits] + ask = "Allow anonymous edits" + type = "boolean" + yes = "true" + no = "false" + help = "Allow users to select freely permission, allowing guests to edit existing notes." + bind = "allow_anonymous_edits:__FINALPATH__/config.json" + + [main.config.allow_email_registration] ask = "Allow email registration" type = "boolean" diff --git a/scripts/install b/scripts/install index 5cdc25d..6d257e0 100644 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME allow_anonymous=false +allow_anonymous_edits=false allow_email_registration=false allow_free_url=false require_free_url_authentication=false @@ -56,6 +57,7 @@ ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication +ynh_app_setting_set --app=$app --key=allow_anonymous_edits --value=$allow_anonymous_edits #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 577b81f..3afcbd2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) allow_anonymous=$(ynh_app_setting_get --app=$app --key=allow_anonymous) +allow_anonymous_edits=$(ynh_app_setting_get --app=$app --key=allow_anonymous_edits) allow_email_registration=$(ynh_app_setting_get --app=$app --key=allow_email_registration) allow_free_url=$(ynh_app_setting_get --app=$app --key=allow_free_url) require_free_url_authentication=$(ynh_app_setting_get --app=$app --key=require_free_url_authentication) @@ -45,6 +46,11 @@ if [ -z "$allow_anonymous" ]; then ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous fi +if [ -z "$allow_anonymous_edits" ]; then + allow_anonymous_edits="false" + ynh_app_setting_set --app=$app --key=allow_anonymous_edits --value=$allow_anonymous_edits +fi + if [ -z "$allow_email_registration" ]; then allow_email_registration="false" ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration