From 668597214f0cfeb9d7a642ef0564e73198b7bc82 Mon Sep 17 00:00:00 2001
From: jejo86 <28619134+jejo86@users.noreply.github.com>
Date: Wed, 3 Aug 2022 12:15:23 +0200
Subject: [PATCH] Improve documentation on becoming server admin (#13230)

* 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

* Improved section regarding server admin

* Reference database settings

Add instructions to check database settings to find out the database name, instead of listing all available PostgreSQL databases.

* 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.

* Update changelog.d/13230.doc

Co-authored-by: reivilibre <olivier@librepush.net>
---
 changelog.d/13230.doc                         | 1 +
 docs/usage/administration/admin_api/README.md | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 changelog.d/13230.doc

diff --git a/changelog.d/13230.doc b/changelog.d/13230.doc
new file mode 100644
index 0000000000..dce7be2425
--- /dev/null
+++ b/changelog.d/13230.doc
@@ -0,0 +1 @@
+Add steps describing how to elevate an existing user to administrator by manipulating the database.
diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md
index c60b6da0de..f11e0b19a6 100644
--- a/docs/usage/administration/admin_api/README.md
+++ b/docs/usage/administration/admin_api/README.md
@@ -5,8 +5,9 @@
 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.
 
+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
 UPDATE users SET admin = 1 WHERE name = '@foo:bar.com';
 ```
-- 
GitLab