Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve documentation on becoming server admin #13230

Merged
merged 5 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13230.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added steps describing how to elevate an existing user to administrator by manipulating a postgres database.
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 11 additions & 1 deletion docs/usage/administration/admin_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is accurate -- not everyone will have a postgres user to switch to. I think this is why it was left a bit agnostic (and isn't copy & paste directions).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to me personally it would have been helpful to have this example to understand what is meant. As it was left agnostic, I could not follow the steps immediately. In other words, I would have preferred to have this information.
I followed the installation guide and pretty quickly switched from SQLite to PostreSQL. I do not know how to do this in SQLite, which is why I am starting the sentence with "When using PostreSQL...". Maybe eventually someone else will extend the instructions for SQLite...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that these directions don't make sense if someone is using postgres on a different system or didn't install it as the postgres user (maybe they're using Docker).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Though I do not have the knowledge about all different kinds of setups to extend the document accordingly. I guess we could start with this information and extend it eventually?! I could prepend an "For example:" for everyone to know that this might not apply to them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @clokep here.

We want to keep it generic here so I would at least drop the part about the postgres user and just mention something like "Connect to the correct database using either psql [database name] (if using PostgreSQL) or sqlite3 path/to/your/database.db (if using SQLite)". This would also allow dropping the \c synapse line below (since it's not needed when you tell psql which database to use directly).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth noting that you could just connect using the same details as you have configured in Synapse's config, whatever they may be.

```sh
su - postgres
psql
```

List all databases, connect to the correct database called e.g. `synapse` and elevate the user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention you can find the database name if the homeserver config file instead of listing them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds sensible.

`@foo:bar.com` to administrator.
```sql
\l
\c synapse
UPDATE users SET admin = 1 WHERE name = '@foo:bar.com';
```

Expand Down