Merge pull request #15187 from vitormattos/bugfix-create-database-user

Bugfix: user is not allowed
This commit is contained in:
Roeland Jago Douma 2019-08-08 09:03:48 +02:00 committed by GitHub
commit b42b26eceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -154,6 +154,10 @@ class PostgreSQL extends AbstractDatabase {
// create the user
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
$query->execute();
if ($this->databaseExists($connection)) {
$query = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO '.addslashes($this->dbUser));
$query->execute();
}
} catch (DatabaseException $e) {
$this->logger->error('Error while trying to create database user');
$this->logger->logException($e);