diff options
author | Simon L <szaimen@e.mail.de> | 2022-11-14 10:02:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 10:02:38 +0100 |
commit | f1b940bc7822073f71003864a6f64feab188d435 (patch) | |
tree | d8446d0bd4c4eba5608c3351ad11e4c1d1f16325 /lib | |
parent | 4bf1f4e484799ae33724f40ef7bd0a79dce20905 (diff) | |
parent | eb7b682dc08f522212a86636994abc90ea926616 (diff) | |
download | nextcloud-server-f1b940bc7822073f71003864a6f64feab188d435.tar.gz nextcloud-server-f1b940bc7822073f71003864a6f64feab188d435.zip |
Merge pull request #34645 from nextcloud/bugfix/support-to-postgres15
🐘 Support postgres15
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Setup/PostgreSQL.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index bc24909dc3d..af816c7ad04 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -62,6 +62,7 @@ class PostgreSQL extends AbstractDatabase { } if ($canCreateRoles) { + $connectionMainDatabase = $this->connect(); //use the admin login data for the new database user //add prefix to the postgresql user name to prevent collisions @@ -70,6 +71,16 @@ class PostgreSQL extends AbstractDatabase { $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, ISecureRandom::CHAR_ALPHANUMERIC); $this->createDBUser($connection); + + // Go to the main database and grant create on the public schema + // The code below is implemented to make installing possible with PostgreSQL version 15: + // https://www.postgresql.org/docs/release/15.0/ + // From the release notes: For new databases having no need to defend against insider threats, granting CREATE permission will yield the behavior of prior releases + // Therefore we assume that the database is only used by one user/service which is Nextcloud + // Additional services should get installed in a separate database in order to stay secure + // Also see https://www.postgresql.org/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS + $connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO ' . addslashes($this->dbUser)); + $connectionMainDatabase->close(); } $this->config->setValues([ |