element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.32k stars 158 forks source link

Add Admin API endpoint to change one's nickname only in a room #17040

Open Marc-Andrieu opened 5 months ago

Marc-Andrieu commented 5 months ago

Description:

Create an endpoint for the Admin API of Synapse, so that a server admin can change a user's nickname that is displayed in a given room only. (Or change the behavior of one which already exists)

Motivation:

In different spaces or channels, corresponding to different communities, one given user may play different roles. We may want to change automatically this user's nickname to match their role in each community (or allow an admin to do so manually), without accessing an access token of this user.

Why it should be easily added:

The feature exists, it's just about allowing a server admin to change other people's nicknames in rooms.

Current Contradictions:

reivilibre commented 4 months ago

The problem is that if we add an admin API command for everything you can do on the CS-API, this quickly gets out of hand :-)

You can use the 'Login as a User' API to get an access token (ideally use the valid_until_ms field so it expires), do the name change using the normal API and then log out the access token again.

Although this takes more steps (which could be scripted away), this is functionally the same.