diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2021-07-29 13:04:41 +0200 |
---|---|---|
committer | npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com> | 2021-07-29 19:31:36 +0000 |
commit | 416d10f76c9b05a5a1e51058486f6e5cffd6c498 (patch) | |
tree | cf4efa06c62498d5bc15d83b7cf8d277b7235643 /lib | |
parent | 6f1c2ed50b036e5f910be48ed84e6e2a9a8e4a89 (diff) | |
download | nextcloud-server-416d10f76c9b05a5a1e51058486f6e5cffd6c498.tar.gz nextcloud-server-416d10f76c9b05a5a1e51058486f6e5cffd6c498.zip |
refs #21045 add app config to disable unlimited quota and to set max quota
avoid unlimited quota as default_quota fallback value if unlimited quota is not allowed
avoid getting/setting/displaying unlimited default quota if not allowed
implement tests for unlimited quota restrictions
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/User.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php index b588ca1a0ee..f17824f51b9 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -411,6 +411,18 @@ class User implements IUser { } if ($quota === 'default') { $quota = $this->config->getAppValue('files', 'default_quota', 'none'); + + // if unlimited quota is not allowed => avoid getting 'unlimited' as default_quota fallback value + // use the first preset instead + $allowUnlimitedQuota = $this->config->getAppValue('files', 'allow_unlimited_quota', '1') === '1'; + if (!$allowUnlimitedQuota) { + $presets = $this->config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); + $presets = array_filter(array_map('trim', explode(',', $presets))); + $quotaPreset = array_values(array_diff($presets, ['default', 'none'])); + if (count($quotaPreset) > 0) { + $quota = $this->config->getAppValue('files', 'default_quota', $quotaPreset[0]); + } + } } return $quota; } |