Merge pull request #1616 from nextcloud/downstream_ldap_6

Prevent user with empty uid
This commit is contained in:
Morris Jobke 2016-10-06 14:43:25 +02:00 committed by GitHub
commit 55e72caf9b
1 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
*
* @license AGPL-3.0
*
@ -32,6 +33,7 @@ use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\Image;
use OCP\IUserManager;
use OCP\Util;
/**
* User
@ -111,6 +113,14 @@ class User {
IConfig $config, FilesystemHelper $fs, Image $image,
LogWrapper $log, IAvatarManager $avatarManager, IUserManager $userManager) {
if ($username === null) {
$log->log("uid for '$dn' must not be null!", Util::ERROR);
throw new \InvalidArgumentException('uid must not be null!');
} else if ($username === '') {
$log->log("uid for '$dn' must not be an empty string", Util::ERROR);
throw new \InvalidArgumentException('uid must not be an empty string!');
}
$this->access = $access;
$this->connection = $access->getConnection();
$this->config = $config;