Skip to content

Commit

Permalink
Merge pull request #15187 from vitormattos/bugfix-create-database-user
Browse files Browse the repository at this point in the history
Bugfix: user is not allowed
  • Loading branch information
rullzer authored Aug 8, 2019
2 parents 4e3ada5 + d12aaa2 commit b42b26e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/private/Setup/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ private function createDBUser(IDBConnection $connection) {
// 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);
Expand Down

0 comments on commit b42b26e

Please sign in to comment.