Also support remote users on the joined_rooms admin API. (#8948)

For remote users, only the rooms which the server knows about are returned.
Local users have all of their joined rooms returned.
This commit is contained in:
David Teller 2021-01-11 20:32:17 +01:00 committed by GitHub
parent c9195744a4
commit b161528fcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 13 deletions

View file

@ -714,13 +714,6 @@ class UserMembershipRestServlet(RestServlet):
async def on_GET(self, request, user_id):
await assert_requester_is_admin(self.auth, request)
if not self.is_mine(UserID.from_string(user_id)):
raise SynapseError(400, "Can only lookup local users")
user = await self.store.get_user_by_id(user_id)
if user is None:
raise NotFoundError("Unknown user")
room_ids = await self.store.get_rooms_for_user(user_id)
ret = {"joined_rooms": list(room_ids), "total": len(room_ids)}
return 200, ret