pull/8617/head
Erik Johnston 2020-11-02 10:04:53 +00:00
parent ae0fef3063
commit 9e89ef6a73
3 changed files with 9 additions and 3 deletions

View File

@ -61,8 +61,14 @@ class AuthBlocking:
certain blocking reasons like MAU.
requester: If present, and the authenticated entity is a user, checks for
presence against existing MAU cohort.
presence against existing MAU cohort. Passing in both a `user_id` and
`requester` is an error.
"""
if requester and user_id:
raise Exception(
"Passed in both 'user_id' and 'requester' to 'check_auth_blocking'"
)
if requester:
if requester.authenticated_entity.startswith("@"):
user_id = requester.authenticated_entity

View File

@ -851,7 +851,7 @@ class UserTokenRestServlet(RestServlet):
if not self.hs.is_mine_id(user_id):
raise SynapseError(400, "Only local users can be logged in as")
body = parse_json_object_from_request(request)
body = parse_json_object_from_request(request, allow_empty_body=True)
valid_until_ms = body.get("valid_until_ms")
if valid_until_ms and not isinstance(valid_until_ms, int):

View File

@ -1759,6 +1759,6 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase):
)
# Logging in as the other user and joining a room should work, even
# though they should be denied.
# though the MAU limit would stop the user doing so.
puppet_token = self._get_token()
self.helper.join(room_id, user=self.other_user, tok=puppet_token)