Synapse: Recover room admin where it has been lost

Created on 15 Jul 2017  路  6Comments  路  Source: matrix-org/synapse

So I got in an incredibly annoying situation:

  • I'm admin or moderator of a room (I forget)
  • I add a moderator to a room
  • The moderator kicks and bans me by accident, then unbans me and reinvites me
  • Now nobody in the room has the permissions necessary to add/remove moderators

How can I resolve this?

Most helpful comment

I eventually figured out an (extremely hacky) workaround:

  • Open synapse/event_auth.py
  • Add return True on the line after def _can_send_event
  • Add return True on the line after def _check_power_levels
  • Restart
  • Change permissions
  • Remove code changes
  • Restart

Clearly this is not the best choice. I think in production return True should be replaced with if is_server_admin: return True.

All 6 comments

I eventually figured out an (extremely hacky) workaround:

  • Open synapse/event_auth.py
  • Add return True on the line after def _can_send_event
  • Add return True on the line after def _check_power_levels
  • Restart
  • Change permissions
  • Remove code changes
  • Restart

Clearly this is not the best choice. I think in production return True should be replaced with if is_server_admin: return True.

How does one set the power level in the postgres database?

This issue should probably be closed. The advice above should not be followed as it messes with event authorization which will not work over federation.

I'm admin or moderator of a room (I forget)
I add a moderator to a room
The moderator kicks and bans me by accident, then unbans me and reinvites me
Now nobody in the room has the permissions necessary to add/remove moderators

This doesn't sound right, incidentally. You should end up with the same power-level after ban/rejoin as you had before it.

How does one set the power level in the postgres database?

I tried to figure that out today, but it did not work. Tried about five different routes, but things don't behave as in the API documentation. Namely, even when I there are no m.room.power-levels messages left for the room and I am entered as the creator as the room in table rooms and have restarted the Matrix server and reloaded the , I am still not admin in that room. There's probably something going on with caching that I don't see. But it's not client-side local storage, because it also happens in Firefox Private Mode.

So doing things in the database is not a solution (for now). On top of that, the Matrix Admin API does not contain a function to modify room membership or permissions. So being a "server admin" user does not help here, either.

I propose to re-open this issue and implement changing power levels and room membership in the admin API.

Was this page helpful?
0 / 5 - 0 ratings