From ee0a22caba0a43757060de00c156d33263bed1ad Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 8 Apr 2024 19:22:26 +0200 Subject: [PATCH] Make system address book access configurable --- config_panel.toml | 9 +++++++++ manifest.toml | 6 ++++++ scripts/config | 11 +++++++++++ scripts/install | 6 ++++++ 4 files changed, 32 insertions(+) diff --git a/config_panel.toml b/config_panel.toml index 7598044..4e458b6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -11,6 +11,15 @@ name = "Nextcloud configuration" type = "boolean" default = "0" + [main.addressbook] + name = "Address book configuration" + + [main.addressbook.system_addressbook_exposed] + ask = "Should there be a system address book listing all users, accessible by all users?" + type = "boolean" + yes = "yes" + no = "no" + [main.php_fpm_config] name = "PHP-FPM configuration" diff --git a/manifest.toml b/manifest.toml index 5a47012..87c12d1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -54,6 +54,12 @@ ram.runtime = "512M" type = "boolean" default = false + [install.system_addressbook_exposed] + ask.en = "Should there be a system address book listing all users, accessible by all users?" + ask.fr = "Devrait-il y avoir un carnet d'adresses système listant tous les comptes, accessible par tous les comptes ?" + type = "select" + choices = ["yes", "no"] + [resources] [resources.sources] diff --git a/scripts/config b/scripts/config index 1b5e26b..93ced20 100644 --- a/scripts/config +++ b/scripts/config @@ -38,6 +38,11 @@ get__maintenance_mode() { fi } +get__system_addressbook_exposed() { + echo $(cd "$install_dir" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ config:app:get dav system_addressbook_exposed) +} + get__fpm_footprint() { # Free footprint value for php-fpm # Check if current_fpm_footprint is an integer @@ -80,6 +85,12 @@ set__maintenance_mode() { ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode" } +set__system_addressbook_exposed() { + (cd "$install_dir" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ config:app:set dav system_addressbook_exposed --value="$system_addressbook_exposed") + ynh_print_info "System addressbook is exposed: $system_addressbook_exposed" +} + set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then diff --git a/scripts/install b/scripts/install index 24cd665..c80a941 100755 --- a/scripts/install +++ b/scripts/install @@ -180,6 +180,12 @@ ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name -- # And delete admin user exec_occ user:delete admin +#================================================= +# ENABLE OR DISABLE SYSTEM ADDRESS BOOK +#================================================= + +exec_occ config:app:set dav system_addressbook_exposed --value="$system_addressbook_exposed" + #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #=================================================