mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 07:24:49 -04:00
Use real AS object by passing it through the requester
This means synapse does not have to check if the AS is interested, but instead it effectively re-uses what it already knew about the requesting user
This commit is contained in:
parent
5b54d51d1e
commit
1b17d1a106
3 changed files with 15 additions and 18 deletions
|
@ -19,7 +19,7 @@ from collections import namedtuple
|
|||
|
||||
|
||||
Requester = namedtuple("Requester",
|
||||
["user", "access_token_id", "is_guest", "device_id"])
|
||||
["user", "access_token_id", "is_guest", "device_id", "as_user"])
|
||||
"""
|
||||
Represents the user making a request
|
||||
|
||||
|
@ -29,11 +29,12 @@ Attributes:
|
|||
request, or None if it came via the appservice API or similar
|
||||
is_guest (bool): True if the user making this request is a guest user
|
||||
device_id (str|None): device_id which was set at authentication time
|
||||
as_user (ApplicationService|None): the AS requesting on behalf of the user
|
||||
"""
|
||||
|
||||
|
||||
def create_requester(user_id, access_token_id=None, is_guest=False,
|
||||
device_id=None):
|
||||
device_id=None, as_user=None):
|
||||
"""
|
||||
Create a new ``Requester`` object
|
||||
|
||||
|
@ -43,13 +44,14 @@ def create_requester(user_id, access_token_id=None, is_guest=False,
|
|||
request, or None if it came via the appservice API or similar
|
||||
is_guest (bool): True if the user making this request is a guest user
|
||||
device_id (str|None): device_id which was set at authentication time
|
||||
as_user (ApplicationService|None): the AS requesting on behalf of the user
|
||||
|
||||
Returns:
|
||||
Requester
|
||||
"""
|
||||
if not isinstance(user_id, UserID):
|
||||
user_id = UserID.from_string(user_id)
|
||||
return Requester(user_id, access_token_id, is_guest, device_id)
|
||||
return Requester(user_id, access_token_id, is_guest, device_id, as_user)
|
||||
|
||||
|
||||
def get_domain_from_id(string):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue