From 1dca10235328296fe41d6682f927253644e32ecd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 17 Jun 2020 16:13:09 +0200 Subject: [PATCH] Public/private is handled by the core using the group permission system --- actions.toml | 15 ------- config_panel.toml | 9 ----- scripts/actions/public_private | 74 ---------------------------------- scripts/config | 15 ------- 4 files changed, 113 deletions(-) delete mode 100755 scripts/actions/public_private diff --git a/actions.toml b/actions.toml index 39f826b..b5f8859 100644 --- a/actions.toml +++ b/actions.toml @@ -13,21 +13,6 @@ description = "Enable or disable the sftp access." ask = "Do you need a SFTP access?" default = true -[public_private] -name = "Move to public or private" -command = "/bin/bash scripts/actions/public_private" -# user = "root" # optional -# cwd = "/" # optional -# accepted_return_codes = [0, 1, 2, 3] # optional -accepted_return_codes = [0] -description = "Change the public access of the app." - - [public_private.arguments] - [public_private.arguments.is_public] - type = "boolean" - ask = "Is it a public app ?" - default = true - [create_database] name = "Create a database" command = "/bin/bash scripts/actions/create_database" diff --git a/config_panel.toml b/config_panel.toml index bcaceb1..f5e1e86 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -18,15 +18,6 @@ name = "My webapp configuration" optional = true help = "If a password already exist, it will not be replaced." - [main.is_public] - name = "Public access" - - [main.is_public.is_public] - ask = "Is it a public website ?" - type = "boolean" - default = true - - [main.overwrite_files] name = "Overwriting config files" diff --git a/scripts/actions/public_private b/scripts/actions/public_private deleted file mode 100755 index 778a6a3..0000000 --- a/scripts/actions/public_private +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -# Get is_public -is_public=${YNH_ACTION_IS_PUBLIC} - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -is_public_old=$(ynh_app_setting_get --app=$app --key=is_public) - -if [ $is_public -eq $is_public_old ] -then - ynh_die --message="is_public is already set as $is_public." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# MOVE TO PUBLIC OR PRIVATE -#================================================= - -if [ $is_public -eq 0 ]; then - public_private="private" -else - public_private="public" -fi -ynh_script_progression --message="Moving the application to $public_private..." --weight=3 - -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete --app=$app --key=skipped_uris -else - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -fi - -ynh_script_progression --message="Upgrading SSOwat configuration..." -# Regen ssowat configuration -yunohost app ssowatconf - -# Update the config of the app -ynh_app_setting_set --app=$app --key=is_public --value=$is_public - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading nginx web server..." - -ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/config b/scripts/config index ebdadf8..2a14858 100644 --- a/scripts/config +++ b/scripts/config @@ -45,11 +45,6 @@ else fi -# is_public -old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)" -is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}" - - # Overwrite nginx configuration old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)" overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}" @@ -88,8 +83,6 @@ show_config() { ynh_return "YNH_CONFIG_MAIN_SFTP_SFTP=$with_sftp" # ynh_return "YNH_CONFIG_MAIN_SFTP_PASSWORD=$password" - ynh_return "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public" - ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint" ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint" ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage" @@ -100,14 +93,6 @@ show_config() { #================================================= apply_config() { - # Change public accessibility - if [ "$is_public" = "1" ] - then - yunohost app action run $app public_private --args is_public=1 - else - yunohost app action run $app public_private --args is_public=0 - fi - #================================================= # REMOVE OR ADD SFTP ACCESS #=================================================