From 6a5a09ba9bd35f8baa95d26651d0f6180934ed7c Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 7 Dec 2022 20:36:22 +0200 Subject: [PATCH] Remove matrix-change-user-admin-status mentions and provide an alternative --- docs/registering-users.md | 27 +++++++++++++++++++-------- docs/updating-users-passwords.md | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/registering-users.md b/docs/registering-users.md index 83f31a22..321346b6 100644 --- a/docs/registering-users.md +++ b/docs/registering-users.md @@ -9,7 +9,7 @@ Table of contents: - [Managing users via a Web UI](#managing-users-via-a-web-ui) - [Letting certain users register on your private server](#letting-certain-users-register-on-your-private-server) - [Enabling public user registration](#enabling-public-user-registration) - - [Adding/Removing Administrator privileges to an existing user](#addingremoving-administrator-privileges-to-an-existing-user) + - [Adding/Removing Administrator privileges to an existing Synapse user](#addingremoving-administrator-privileges-to-an-existing-synapse-user) ## Registering users manually @@ -58,13 +58,24 @@ and running the [installation](installing.md) procedure once again. If you're opening up registrations publicly like this, you might also wish to [configure CAPTCHA protection](configuring-captcha.md). -## Adding/Removing Administrator privileges to an existing user +## Adding/Removing Administrator privileges to an existing Synapse user -The script `/usr/local/bin/matrix-change-user-admin-status` may be used to change a user's admin privileges. - -* log on to your server with ssh -* execute with the username and 0/1 (0 = non-admin | 1 = admin) +To change the admin privileges for a user, you need to run an SQL query like this against the `synapse` database: +```sql +UPDATE users SET admin=ADMIN_VALUE WHERE name = '@USER:DOMAIN' ``` -/usr/local/bin/matrix-change-user-admin-status <0/1> -``` + +where: + +- `ADMIN_VALUE` being either `0` (regular user) or `1` (admin) +- `USER` and `DOMAIN` pointing to a valid user on your server + +If you're using the integrated Postgres server and not an [external Postgres server](configuring-playbook-external-postgres.md), you can launch a Postgres into the `synapse` database by: + +- running `/matrix/postgres/bin/cli` - to launch [`psql`](https://www.postgresql.org/docs/current/app-psql.html) +- running `\c synapse` - to change to the `synapse` database + +You can then proceed to run the query above. + +**Note**: directly modifying the raw data of Synapse (or any other software) could cause the software to break. You've been warned! diff --git a/docs/updating-users-passwords.md b/docs/updating-users-passwords.md index 30aa8c99..98663c60 100644 --- a/docs/updating-users-passwords.md +++ b/docs/updating-users-passwords.md @@ -36,7 +36,7 @@ Use the Synapse User Admin API as described here: https://github.com/matrix-org/ This requires an [access token](obtaining-access-tokens.md) from a server admin account. *This method will also log the user out of all of their clients while the other options do not.* -If you didn't make your account a server admin when you created it, you can use the `/usr/local/bin/matrix-change-user-admin-status` script as described in [registering-users.md](registering-users.md). +If you didn't make your account a server admin when you created it, you can learn how to switch it now by reading about it in [Adding/Removing Administrator privileges to an existing Synapse user](registering-users.md#addingremoving-administrator-privileges-to-an-existing-synapse-user). ### Example: To set @user:domain.com's password to `correct_horse_battery_staple` you could use this curl command: