Commit 40d8bab1 authored by ibuler's avatar ibuler

[Update] merge

parents dcc74364 55d16aeb
......@@ -159,20 +159,35 @@ class ProxyNamespace(BaseNamespace):
def on_token(self, message):
# 此处获取token含有的主机的信息
logger.debug("On token trigger")
logger.debug(message)
token = message.get('token', None)
secret = message.get('secret', None)
user_id = message.get('user', None)
self.current_user = self.app.service.get_user_profile(user_id)
host = self.app.service.get_token_asset(token).json()
connection = str(uuid.uuid4())
self.emit('room', {'room': connection, 'secret': secret})
if not (token or secret):
logger.debug("token or secret is None")
self.emit('data', {'data': "\nOperation not permitted!", 'room': connection})
self.emit('disconnect')
return None
host = self.app.service.get_token_asset(token)
logger.debug(host)
if not host:
logger.debug("host is None")
self.emit('data', {'data': "\nOperation not permitted!", 'room': connection})
self.emit('disconnect')
return None
user_id = host.get('user', None)
logger.debug("self.current_user")
self.current_user = self.app.service.get_user_profile(user_id)
logger.debug(self.current_user)
# {
# "user": {UUID},
# "asset": {UUID},
# "system_user": {UUID}
# }
connection = str(uuid.uuid4())
self.emit('room', {'room': connection, 'secret': secret})
self.on_host({'secret': secret, 'uuid': host['asset'], 'userid': host['system_user']})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment