This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Delete devices and pushers on logouts etc#2722
Merged
Merged
Conversation
Whenever an access token is invalidated, we should remove the associated pushers.
Non-functional refactoring to move deactivate_account. This means that we'll be able to properly deactivate devices and access tokens without introducing a dependency loop.
Non-functional refactoring to move set_password. This means that we'll be able to properly deactivate devices and access tokens without introducing a dependency loop.
Make sure that we delete devices whenever a user is logged out due to any of the following situations: * /logout * /logout_all * change password * deactivate account (by the user or by an admin) * invalidate access token from a dynamic module Fixes #2672.
| defer.Deferred[list[str, str|None]]: a list of the deleted tokens | ||
| and device IDs | ||
| defer.Deferred[list[str, int, str|None, int]]: a list of | ||
| (token, token id, device id) for each of the deleted tokens |
Member
There was a problem hiding this comment.
Why are we changing this? It doesn't seem to be used elsewhere in the code?
Member
Author
There was a problem hiding this comment.
we need the token_id so that we can delete the pushers which correspond to the deleted access tokens: 2c6d639#diff-b8464485d36f6f87caee3f4d82524213R743
| user_id = user_info["user"].to_string() | ||
| if device_id: | ||
| # delete the device, which will also delete its access tokens | ||
| yield self.hs.get_device_handler().delete_device(user_id, device_id) |
Member
There was a problem hiding this comment.
So there's always going to be only one access token per device?
Member
Author
There was a problem hiding this comment.
yes, that's what we expect.
erikjohnston
approved these changes
Nov 29, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a set of four commits - each is probably worth looking at separately.
The idea is to make sure that we delete devices and pushers whenever a user logs out, to try to avoid accumulating them forever.