summaryrefslogtreecommitdiffstats
path: root/lib/private/Setup
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-08-08 09:03:48 +0200
committerGitHub <noreply@github.com>2019-08-08 09:03:48 +0200
commitb42b26eceb4a2d6aee3c844d3bf057df1d14a77a (patch)
tree6a3f011cf87baeccb808203145f7a4ea7404889e /lib/private/Setup
parent4e3ada512dd11427d23660157b7dfdb2d8ba96d4 (diff)
parentd12aaa221d2246666d2065d76aaa2ad6a3713910 (diff)
downloadnextcloud-server-b42b26eceb4a2d6aee3c844d3bf057df1d14a77a.tar.gz
nextcloud-server-b42b26eceb4a2d6aee3c844d3bf057df1d14a77a.zip
Merge pull request #15187 from vitormattos/bugfix-create-database-user
Bugfix: user is not allowed
Diffstat (limited to 'lib/private/Setup')
-rw-r--r--lib/private/Setup/PostgreSQL.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php
index 283ab5f925c..6d1b5ca2927 100644
--- a/lib/private/Setup/PostgreSQL.php
+++ b/lib/private/Setup/PostgreSQL.php
@@ -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);