From dc6c37b671ab0c325fe7be57772b545a3ff0db7a Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 10 Mar 2024 21:59:09 +0100 Subject: [PATCH 1/2] Fix attempt --- manifest.toml | 4 ++-- scripts/install | 3 --- scripts/upgrade | 3 --- tests.toml | 3 --- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/manifest.toml b/manifest.toml index f418fd9..a92b7d1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -35,7 +35,7 @@ ram.runtime = "250M" # this is a generic question - ask strings are automatically handled by YunoHost's core type = "domain" - [install.init_main_permission] + [install.admin] help.en = "Choose the user who can access to silverbullet" help.fr = "Choisissez l'utilisateur pouvant accéder à silverbullet" type = "user" @@ -57,10 +57,10 @@ ram.runtime = "250M" [resources.install_dir] [resources.data_dir] + subdirs = [ "notes" ] [resources.permissions] main.url = "/" - main.permissions = "visitors" # The app is protected by a user/password prompt [resources.ports] main.default = 3000 diff --git a/scripts/install b/scripts/install index e275215..56785b3 100755 --- a/scripts/install +++ b/scripts/install @@ -35,9 +35,6 @@ ynh_add_config --template="custom.env" --destination="$data_dir/custom.env" chmod 600 "$data_dir/custom.env" chown "$app:$app" "$data_dir/custom.env" -# Create notes subdir -install -d -m 700 -o $app -g $app $data_dir/notes - #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bb37a89..2fa72f5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,9 +40,6 @@ ynh_add_config --template="custom.env" --destination="$data_dir/custom.env" chmod 600 "$data_dir/custom.env" chown "$app:$app" "$data_dir/custom.env" -# Create notes subdir -install -d -m 700 -o $app -g $app $data_dir/notes - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= diff --git a/tests.toml b/tests.toml index 0299d95..e003427 100644 --- a/tests.toml +++ b/tests.toml @@ -4,9 +4,6 @@ test_format = 1.0 [default] - exclude = ["install.subdir"] - args.init_main_permission = "package_checker" - # ------------------------------- # Commits to test upgrade from # ------------------------------- From fb26fdf43c76256c2eb0d7e3a722ff4ded7054ef Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 10 Mar 2024 22:05:42 +0100 Subject: [PATCH 2/2] add ynh_permission_update --- scripts/install | 5 +++++ scripts/restore | 2 ++ scripts/upgrade | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/scripts/install b/scripts/install index 56785b3..15653a0 100755 --- a/scripts/install +++ b/scripts/install @@ -35,6 +35,11 @@ ynh_add_config --template="custom.env" --destination="$data_dir/custom.env" chmod 600 "$data_dir/custom.env" chown "$app:$app" "$data_dir/custom.env" +#================================================= +# SET PERMISSION FOR THE USER +#================================================= +ynh_permission_update --permission="main" --add="$admin" + #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 8209a2f..15186a9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -41,6 +41,8 @@ systemctl enable "$app.service" --quiet yunohost service add "$app" --description="The hacker's notebook" +ynh_permission_update --permission="main" --add="$admin" + #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2fa72f5..42d0b9c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,11 @@ ynh_add_config --template="custom.env" --destination="$data_dir/custom.env" chmod 600 "$data_dir/custom.env" chown "$app:$app" "$data_dir/custom.env" +#================================================= +# SET PERMISSION FOR THE USER +#================================================= +ynh_permission_update --permission="main" --add="$admin" + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #=================================================