From 0670c7cedf6fded7c9e02c7581840a3d8216e228 Mon Sep 17 00:00:00 2001 From: szaimen Date: Mon, 14 Mar 2022 15:35:37 +0100 Subject: [PATCH] Disallow creation of local external storage in some cases Signed-off-by: szaimen --- Containers/nextcloud/entrypoint.sh | 7 +++++++ php/containers.json | 3 ++- php/src/Docker/DockerActionManager.php | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 0e7e86ac..c9d4f3b9 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -251,6 +251,13 @@ php /var/www/html/occ config:system:set overwrite.cli.url --value="https://$NC_D php /var/www/html/occ config:system:set htaccess.RewriteBase --value="/" php /var/www/html/occ maintenance:update:htaccess +# Disallow creating local external storages when nothing was mounted +if [ -z "$NEXTCLOUD_MOUNT" ]; then + php /var/www/html/occ config:system:set files_external_allow_create_new_local --type=bool --value=false +else + php /var/www/html/occ config:system:set files_external_allow_create_new_local --type=bool --value=true +fi + # AIO app if [ "$(php /var/www/html/occ config:app:get nextcloud-aio enabled)" = "" ]; then php /var/www/html/occ app:enable nextcloud-aio diff --git a/php/containers.json b/php/containers.json index dd83fece..91b9ccea 100644 --- a/php/containers.json +++ b/php/containers.json @@ -122,7 +122,8 @@ "OVERWRITEPROTOCOL=https", "TURN_SECRET=%TURN_SECRET%", "SIGNALING_SECRET=%SIGNALING_SECRET%", - "AIO_URL=%AIO_URL%" + "AIO_URL=%AIO_URL%", + "NEXTCLOUD_MOUNT=%NEXTCLOUD_MOUNT%" ], "maxShutdownTime": 10, "restartPolicy": "unless-stopped" diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 67fda28d..82814efe 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -216,6 +216,8 @@ class DockerActionManager $replacements[1] = $this->configurationManager->GetSelectedRestoreTime(); } elseif ($out[1] === 'APACHE_PORT') { $replacements[1] = $this->configurationManager->GetApachePort(); + } elseif ($out[1] === 'NEXTCLOUD_MOUNT') { + $replacements[1] = $this->configurationManager->GetNextcloudMount(); } else { $replacements[1] = $this->configurationManager->GetSecret($out[1]); }