Do not allow to have an empty display name
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
704c7b6672
commit
b9f963225f
|
@ -70,8 +70,9 @@ class Add extends Base {
|
|||
$group = $this->groupManager->createGroup($gid);
|
||||
$output->writeln('Created group "' . $group->getGID() . '"');
|
||||
|
||||
if ($input->hasOption('display-name')) {
|
||||
$group->setDisplayName($input->getOption('display-name'));
|
||||
$displayName = trim((string) $input->getOption('display-name'));
|
||||
if ($displayName !== '') {
|
||||
$group->setDisplayName($displayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ class Database extends ABackend
|
|||
$builder = $this->dbConn->getQueryBuilder();
|
||||
$result = $builder->insert('groups')
|
||||
->setValue('gid', $builder->createNamedParameter($gid))
|
||||
->setValue('displayname', $builder->createNamedParameter($gid))
|
||||
->execute();
|
||||
} catch(UniqueConstraintViolationException $e) {
|
||||
$result = 0;
|
||||
|
@ -451,6 +452,11 @@ class Database extends ABackend
|
|||
|
||||
$this->fixDI();
|
||||
|
||||
$displayName = trim($displayName);
|
||||
if ($displayName === '') {
|
||||
$displayName = $gid;
|
||||
}
|
||||
|
||||
$query = $this->dbConn->getQueryBuilder();
|
||||
$query->update('groups')
|
||||
->set('displayname', $query->createNamedParameter($displayName))
|
||||
|
|
Loading…
Reference in New Issue