diff options
author | Travis Ralston <travpc@gmail.com> | 2021-01-21 12:35:05 -0700 |
---|---|---|
committer | Travis Ralston <travpc@gmail.com> | 2021-01-21 12:35:05 -0700 |
commit | f7a03e86e0f99724acd28963e7600f13b487ce19 (patch) | |
tree | 7a0846bdf1d8b4b9526262eccd885e99fdb5e213 /synapse/handlers/message.py | |
parent | Merge branch 'travis/fosdem/admin-api-groups' into travis/fosdem/hotfixes (diff) | |
parent | Get the right requester object (diff) | |
download | synapse-f7a03e86e0f99724acd28963e7600f13b487ce19.tar.xz |
Merge branch 'travis/fosdem/admin-api-room-state' into travis/fosdem/hotfixes
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 9dfeab09cd..457491b75d 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -137,6 +137,7 @@ class MessageHandler: state_filter: StateFilter = StateFilter.all(), at_token: Optional[StreamToken] = None, is_guest: bool = False, + is_admin: bool = False, ) -> List[dict]: """Retrieve all state events for a given room. If the user is joined to the room then return the current state. If the user has @@ -153,6 +154,7 @@ class MessageHandler: stream token, we raise a 403 SynapseError. If None, returns the current state based on the current_state_events table. is_guest: whether this user is a guest + is_admin: whether this user is making the request as a server admin. Returns: A list of dicts representing state events. [{}, {}, {}] Raises: @@ -173,9 +175,12 @@ class MessageHandler: if not last_events: raise NotFoundError("Can't find event for token %s" % (at_token,)) - visible_events = await filter_events_for_client( - self.storage, user_id, last_events, filter_send_to_client=False - ) + if is_admin: + visible_events = last_events + else: + visible_events = await filter_events_for_client( + self.storage, user_id, last_events, filter_send_to_client=False, + ) event = last_events[0] if visible_events: @@ -197,7 +202,7 @@ class MessageHandler: room_id, user_id, allow_departed_users=True ) - if membership == Membership.JOIN: + if membership == Membership.JOIN or is_admin: state_ids = await self.store.get_filtered_current_state_ids( room_id, state_filter=state_filter ) |