diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2018-04-04 17:19:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 17:19:54 +0200 |
commit | 3678d3b14af7331e5f99fbf34e5aef26a65637ab (patch) | |
tree | b279ab85cc726b4083ba42b1be2ec27c631ae849 /apps/provisioning_api/lib | |
parent | 9c4d5628084784bf3d14e9ae4f2e750bd537acef (diff) | |
parent | 63fa245461228225e196b43a8f338536358b76b2 (diff) | |
download | nextcloud-server-3678d3b14af7331e5f99fbf34e5aef26a65637ab.tar.gz nextcloud-server-3678d3b14af7331e5f99fbf34e5aef26a65637ab.zip |
Merge pull request #8926 from nextcloud/ocs-api-quota-fallback
Return quota even if user is not initialised
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index e3b7840cd3b..c8c00fa8592 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -909,7 +909,16 @@ class UsersController extends OCSController { 'quota' => $storage['quota'], ]; } catch (NotFoundException $ex) { - $data = []; + // User fs is not setup yet + $user = $this->userManager->get($userId); + if ($user === null) { + throw new OCSException('User does not exist', 101); + } + $quota = OC_Helper::computerFileSize($user->getQuota()); + $data = [ + 'quota' => $quota ? $quota : 'none', + 'used' => 0 + ]; } return $data; } |