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

Add a /user/:user_id/info servlet to give user deactivated/expired information #12

Merged
merged 6 commits into from
Nov 14, 2019

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Nov 7, 2019

Provides an endpoint /client/r0/user/{user_id}/info that responds with the following JSON body to authenticated users:

{
  "deactivated": false|true,
  "expired": false|true
}

Sytest PR: matrix-org/sytest#741

TODO:

  • Federation endpoint

Gives details about whether a user is deactivated or expired.
@anoadragon453 anoadragon453 self-assigned this Nov 7, 2019
@anoadragon453 anoadragon453 changed the title Add a /user/:user_id/info servlet to give user deactivate/expired information Add a /user/:user_id/info servlet to give user deactivated/expired information Nov 11, 2019
@anoadragon453 anoadragon453 requested a review from a team November 12, 2019 16:45
@anoadragon453 anoadragon453 merged commit 28578e7 into dinsic Nov 14, 2019
@anoadragon453 anoadragon453 deleted the anoa/user_info_endpoint branch November 14, 2019 14:23
anoadragon453 added a commit that referenced this pull request Jun 19, 2020
The current `/user/<user_id>/info` API was useful in that it could be used by any user to lookup whether another user was deactivate or expired. However, it was impractical as it only allowed for a single lookup at once. Clients trying to use this API were met with speed issues as they tried to query this information for all users in a room.

This PR adds an equivalent CS and Federation API that takes a list of user IDs, and returning a mapping from user ID to info dictionary.

Note that the federation in this PR was a bit trickier than in the original #12 as we can no longer use a federation query, as those don't allow for JSON bodies - which we require to pass a list of user IDs. Instead we do the whole thing of adding a method to transport/client and transport/server.

This PR also adds unittests. The earlier PR used Sytest, presumably for testing across federation, but as this is Synapse-specific that felt a little gross. Unit tests for the deprecated endpoint have not been added.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants