diff options
author | Juan Pablo Villafáñez <jvillafanez@solidgear.es> | 2017-03-14 17:08:05 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-03-29 13:32:16 +0200 |
commit | f9832ff3475a1feec9d8b8d2d42bbf56d72c0118 (patch) | |
tree | 73f9ca402240f88faaaa67a27aa097f943c96ac3 /apps/user_ldap/lib | |
parent | 3345a72e7e4a5d11b1140d17b46567b65055f2e9 (diff) | |
download | nextcloud-server-f9832ff3475a1feec9d8b8d2d42bbf56d72c0118.tar.gz nextcloud-server-f9832ff3475a1feec9d8b8d2d42bbf56d72c0118.zip |
Check if the user exists before trying to set the quota
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/User/User.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 7a840de87f6..392cb2e51ba 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -498,11 +498,16 @@ class User { } } - if($quota !== false) { - $this->userManager->get($this->uid)->setQuota($quota); + $targetUser = $this->userManager->get($this->uid); + if ($targetUser) { + if($quota !== false) { + $targetUser->setQuota($quota); + } else { + $this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN); + $targetUser->setQuota('default'); + } } else { - $this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN); - $this->userManager->get($this->uid)->setQuota('default'); + $this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', \OCP\Util::ERROR); } } |