Remove completely unused concepts from codebase

Removes device_id and ClientInfo

device_id is never actually written, and the matrix.org DB has no
non-null entries for it. Right now, it's just cluttering up code.

This doesn't remove the columns from the database, because that's
fiddly.
This commit is contained in:
Daniel Wagner-Hall 2015-08-25 16:23:06 +01:00
parent aa361f51dc
commit a0b181bd17
29 changed files with 63 additions and 90 deletions

View file

@ -20,7 +20,7 @@ from twisted.internet import defer
from synapse.api.constants import EventTypes, Membership, JoinRules
from synapse.api.errors import AuthError, Codes, SynapseError
from synapse.util.logutils import log_function
from synapse.types import UserID, ClientInfo
from synapse.types import UserID
import logging
@ -322,9 +322,9 @@ class Auth(object):
Args:
request - An HTTP request with an access_token query parameter.
Returns:
tuple : of UserID and device string:
User ID object of the user making the request
ClientInfo object of the client instance the user is using
tuple of:
UserID (str)
Access token ID (str)
Raises:
AuthError if no user by that token exists or the token is invalid.
"""
@ -355,7 +355,7 @@ class Auth(object):
request.authenticated_entity = user_id
defer.returnValue(
(UserID.from_string(user_id), ClientInfo("", ""))
(UserID.from_string(user_id), "")
)
return
except KeyError:
@ -363,7 +363,6 @@ class Auth(object):
user_info = yield self.get_user_by_access_token(access_token)
user = user_info["user"]
device_id = user_info["device_id"]
token_id = user_info["token_id"]
ip_addr = self.hs.get_ip_from_request(request)
@ -375,14 +374,13 @@ class Auth(object):
self.store.insert_client_ip(
user=user,
access_token=access_token,
device_id=user_info["device_id"],
ip=ip_addr,
user_agent=user_agent
)
request.authenticated_entity = user.to_string()
defer.returnValue((user, ClientInfo(device_id, token_id)))
defer.returnValue((user, token_id,))
except KeyError:
raise AuthError(
self.TOKEN_NOT_FOUND_HTTP_STATUS, "Missing access token.",
@ -396,7 +394,7 @@ class Auth(object):
Args:
token (str): The access token to get the user by.
Returns:
dict : dict that includes the user, device_id, and whether the
dict : dict that includes the user and whether the
user is a server admin.
Raises:
AuthError if no user by that token exists or the token is invalid.
@ -409,7 +407,6 @@ class Auth(object):
)
user_info = {
"admin": bool(ret.get("admin", False)),
"device_id": ret.get("device_id"),
"user": UserID.from_string(ret.get("name")),
"token_id": ret.get("token_id", None),
}