From 7e3d65ef8695e6159de4040519da9561d29c7e46 Mon Sep 17 00:00:00 2001 From: jejo86 <28619134+jejo86@users.noreply.github.com> Date: Fri, 8 Jul 2022 22:46:20 +0200 Subject: [PATCH 1/5] Improved section regarding server admin Added steps describing how to elevate an existing user to administrator by manipulating a `postgres` database. Signed-off-by: jejo86 28619134+jejo86@users.noreply.github.com --- docs/usage/administration/admin_api/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md index 3cbedc5dfa30..caae057d6402 100644 --- a/docs/usage/administration/admin_api/README.md +++ b/docs/usage/administration/admin_api/README.md @@ -5,9 +5,19 @@ Many of the API calls in the admin api will require an `access_token` for a server admin. (Note that a server admin is distinct from a room admin.) -A user can be marked as a server admin by updating the database directly, e.g.: +An existing user can be marked as a server admin by updating the database directly. +When using PostgreSQL, switch to the `postgres` user and start the command line tool. +```sh +su - postgres +psql +``` + +List all databases, connect to the correct database called e.g. `synapse` and elevate the user +`@foo:bar.com` to administrator. ```sql +\l +\c synapse UPDATE users SET admin = 1 WHERE name = '@foo:bar.com'; ``` From 8e235ad05d0815991887fad3dee16ff8be0cdf50 Mon Sep 17 00:00:00 2001 From: jejo86 <28619134+jejo86@users.noreply.github.com> Date: Fri, 8 Jul 2022 22:51:02 +0200 Subject: [PATCH 2/5] Improved section regarding server admin --- changelog.d/13230.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/13230.doc diff --git a/changelog.d/13230.doc b/changelog.d/13230.doc new file mode 100644 index 000000000000..b08d8dfb14c6 --- /dev/null +++ b/changelog.d/13230.doc @@ -0,0 +1 @@ +Added steps describing how to elevate an existing user to administrator by manipulating a postgres database. From 847e45a9c10e7c6b24a7266951171c9961e1fb0a Mon Sep 17 00:00:00 2001 From: jejo86 <28619134+jejo86@users.noreply.github.com> Date: Wed, 13 Jul 2022 19:37:56 +0200 Subject: [PATCH 3/5] Reference database settings Add instructions to check database settings to find out the database name, instead of listing all available PostgreSQL databases. --- docs/usage/administration/admin_api/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md index caae057d6402..6f45802a3eea 100644 --- a/docs/usage/administration/admin_api/README.md +++ b/docs/usage/administration/admin_api/README.md @@ -13,10 +13,9 @@ su - postgres psql ``` -List all databases, connect to the correct database called e.g. `synapse` and elevate the user -`@foo:bar.com` to administrator. +Check your [database settings](config_documentation.md#database) in the `homeserver.yaml`, connect to the +specified database called e.g. `synapse` and elevate the user `@foo:bar.com` to administrator. ```sql -\l \c synapse UPDATE users SET admin = 1 WHERE name = '@foo:bar.com'; ``` From 315a94c802df2beb39aa188f3b3a60cedced6b7b Mon Sep 17 00:00:00 2001 From: jejo86 <28619134+jejo86@users.noreply.github.com> Date: Sat, 23 Jul 2022 07:37:28 +0200 Subject: [PATCH 4/5] Add suggestions from PR conversation Replace config filename `homeserver.yaml`. with "config file". Remove instructions to switch to `postgres` user. Add instructions how to connect to SQLite database. --- docs/usage/administration/admin_api/README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md index 6f45802a3eea..a47339b182d5 100644 --- a/docs/usage/administration/admin_api/README.md +++ b/docs/usage/administration/admin_api/README.md @@ -7,16 +7,8 @@ server admin. (Note that a server admin is distinct from a room admin.) An existing user can be marked as a server admin by updating the database directly. -When using PostgreSQL, switch to the `postgres` user and start the command line tool. -```sh -su - postgres -psql -``` - -Check your [database settings](config_documentation.md#database) in the `homeserver.yaml`, connect to the -specified database called e.g. `synapse` and elevate the user `@foo:bar.com` to administrator. +Check your [database settings](config_documentation.md#database) in the configuration file, connect to the correct database using either `psql [database name]` (if using PostgreSQL) or `sqlite3 path/to/your/database.db` (if using SQLite) and elevate the user `@foo:bar.com` to administrator. ```sql -\c synapse UPDATE users SET admin = 1 WHERE name = '@foo:bar.com'; ``` From c22752602484fe400c217fb247aadd7eee0b7025 Mon Sep 17 00:00:00 2001 From: reivilibre Date: Wed, 3 Aug 2022 11:14:58 +0100 Subject: [PATCH 5/5] Update changelog.d/13230.doc --- changelog.d/13230.doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/13230.doc b/changelog.d/13230.doc index b08d8dfb14c6..dce7be24251f 100644 --- a/changelog.d/13230.doc +++ b/changelog.d/13230.doc @@ -1 +1 @@ -Added steps describing how to elevate an existing user to administrator by manipulating a postgres database. +Add steps describing how to elevate an existing user to administrator by manipulating the database.