This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
synapse.api.auth.Auth
cleanup: make permission-related methods useRequester
instead of theUserID
#13024synapse.api.auth.Auth
cleanup: make permission-related methods useRequester
instead of theUserID
#13024Changes from 6 commits
5358b88
68474ee
6f2c0c3
7beb0a4
c4bb34d
bcfa8d9
6e41a06
1670733
f74ff1f
9f91f78
2a926c6
f48a202
7baca38
1f3cceb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this parameter because I moved the
mark_access_token_as_used
here, because thetoken_used
exists in theTokenLookupResult
but not in theRequester
; but there are places where we're callingget_user_by_access_token
and don't really want to mark the token as used in those cases (although I guess we could?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is fine, though I wonder if the default should be
True
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to remove this parameter altogether? (see my comment below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of this parameter in 1670733
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it more about the type of token than what it was used to authenticate (which this function doesn't know)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. This method is used in three places:
Auth.get_user_by_req
(this is where we want to mark the token as used)invalidate_access_token(token: str)
method...which makes me think that I don't really know why I kept that parameter in the first place 🤔
Should I just get rid of this parameter? And maybe make the
ModuleApi.invalidate_access_token
method use theStore.get_user_by_access_token
directly instead of theAuth
one?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, getting rid of it seems sensible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of the parameter in 1670733