diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2021-07-30 10:26:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 10:26:56 +0200 |
commit | 7170c03f0e11a2f7385d909cd0b98f90e0ce984c (patch) | |
tree | 1b6a16ca246bb85548d7530b0cd57231bed963d1 /lib/private | |
parent | a9b38d824573051cc0d2cfbe981636ba65f5b635 (diff) | |
parent | 416d10f76c9b05a5a1e51058486f6e5cffd6c498 (diff) | |
download | nextcloud-server-7170c03f0e11a2f7385d909cd0b98f90e0ce984c.tar.gz nextcloud-server-7170c03f0e11a2f7385d909cd0b98f90e0ce984c.zip |
Merge pull request #28009 from nextcloud/enh/21045/quota-restrictions
Add quota restrictions options
Diffstat (limited to 'lib/private')
-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; } |