From d7ecb4bbc2dc35773ee3caac11cb15cd08fd12b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Nov 2022 23:39:11 +0100 Subject: [PATCH] create account --- conf/LocalSettings.php | 2 ++ config_panel.toml | 12 ++++++++++++ scripts/install | 3 +++ scripts/upgrade | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/conf/LocalSettings.php b/conf/LocalSettings.php index cde5fe7..11b4d0c 100644 --- a/conf/LocalSettings.php +++ b/conf/LocalSettings.php @@ -181,3 +181,5 @@ $LDAPProviderDomainConfigProvider = function() { return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config ); }; + +$wgGroupPermissions['*']['createaccount'] = __CREATE_ACCOUNT__; diff --git a/config_panel.toml b/config_panel.toml index 8345a64..94c135d 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -3,6 +3,18 @@ version = "1.0" [main] name = "Mediawiki configuration" + + [main.config] + name = "Configuration Options" + + [main.config.create_account] + ask = "Create account" + type = "boolean" + yes = true + no = false + help = "Set to 'true' to allow account creation." + bind = "create_account:__FINALPATH__/LocalSettings.php" + [main.php_fpm_config] name = "PHP-FPM configuration" diff --git a/scripts/install b/scripts/install index f0db06a..f75bfaf 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,10 @@ source /usr/share/yunohost/helpers #================================================= secret=$(ynh_string_random --length=64) +create_account=false + ynh_app_setting_set --app=$app --key=secret --value=$secret +ynh_app_setting_set --app=$app --key=create_account --value=$create_account #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 9f24c06..f96a91b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,12 @@ if [ -z "${fpm_usage:-}" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi +# If create_account doesn't exist, create it +if [ -z "$create_account" ]; then + create_account=false + ynh_app_setting_set --app=$app --key=create_account --value=$create_account +fi + # Removed in dec. 2020 ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user) if [[ -n "${ldap_user:-}" ]]; then