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 /apps/provisioning_api/lib/Controller/UsersController.php | |
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 'apps/provisioning_api/lib/Controller/UsersController.php')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 01e4bac9c2b..a0eda5848ec 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -798,9 +798,20 @@ class UsersController extends AUserData { if ($quota === -1) { $quota = 'none'; } else { + $maxQuota = (int) $this->config->getAppValue('files', 'max_quota', '-1'); + if ($maxQuota !== -1 && $quota > $maxQuota) { + throw new OCSException('Invalid quota value. ' . $value . ' is exceeding the maximum quota', 102); + } $quota = \OCP\Util::humanFileSize($quota); } } + // no else block because quota can be set to 'none' in previous if + if ($quota === 'none') { + $allowUnlimitedQuota = $this->config->getAppValue('files', 'allow_unlimited_quota', '1') === '1'; + if (!$allowUnlimitedQuota) { + throw new OCSException('Unlimited quota is forbidden on this instance', 102); + } + } $targetUser->setQuota($quota); break; case 'password': |