diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2019-08-30 17:36:38 +0100 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2019-08-30 17:36:38 +0100 |
commit | bed1e94ca05ab8b644e235f694502f23ceedd4fc (patch) | |
tree | 3f6f1663fd950381708ea3ecc40ab2e178c4bf9f /synapse/api/auth.py | |
parent | Merge branch 'anoa/m_id_access_token' into anoa/v2_is (diff) | |
parent | Revert "Add m.id_access_token flag (#5930)" (#5945) (diff) | |
download | synapse-bed1e94ca05ab8b644e235f694502f23ceedd4fc.tar.xz |
Merge branch 'develop' into anoa/v2_is
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r-- | synapse/api/auth.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index 7b3a5a8221..fd3cdf50b0 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -276,25 +276,25 @@ class Auth(object): self.get_access_token_from_request(request) ) if app_service is None: - return (None, None) + return None, None if app_service.ip_range_whitelist: ip_address = IPAddress(self.hs.get_ip_from_request(request)) if ip_address not in app_service.ip_range_whitelist: - return (None, None) + return None, None if b"user_id" not in request.args: - return (app_service.sender, app_service) + return app_service.sender, app_service user_id = request.args[b"user_id"][0].decode("utf8") if app_service.sender == user_id: - return (app_service.sender, app_service) + return app_service.sender, app_service if not app_service.is_interested_in_user(user_id): raise AuthError(403, "Application service cannot masquerade as this user.") if not (yield self.store.get_user_by_id(user_id)): raise AuthError(403, "Application service has not registered this user") - return (user_id, app_service) + return user_id, app_service @defer.inlineCallbacks def get_user_by_access_token(self, token, rights="access"): @@ -694,7 +694,7 @@ class Auth(object): # * The user is a guest user, and has joined the room # else it will throw. member_event = yield self.check_user_was_in_room(room_id, user_id) - return (member_event.membership, member_event.event_id) + return member_event.membership, member_event.event_id except AuthError: visibility = yield self.state.get_current_state( room_id, EventTypes.RoomHistoryVisibility, "" @@ -703,7 +703,7 @@ class Auth(object): visibility and visibility.content["history_visibility"] == "world_readable" ): - return (Membership.JOIN, None) + return Membership.JOIN, None return raise AuthError( 403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN |