Include user name in console proxy logs.

This commit is contained in:
Julien Fontanet 2015-11-17 16:24:22 +01:00
parent fe48811047
commit b03f38ff22
2 changed files with 13 additions and 1 deletions

View File

@ -481,6 +481,12 @@ const setUpConsoleProxy = (webServer, xo) => {
if (!await xo.hasPermissions(user.id, [ [ id, 'operate' ] ])) { // eslint-disable-line space-before-keywords
throw new InvalidCredential()
}
const { remoteAddress } = socket
debug('+ Console proxy (%s - %s)', user.name, remoteAddress)
socket.on('close', () => {
debug('- Console proxy (%s - %s)', user.name, remoteAddress)
})
}
const xapi = xo.getXAPI(id, ['VM', 'VM-controller'])

View File

@ -369,7 +369,13 @@ export default class Xo extends EventEmitter {
// TODO: this method will no longer be async when users are
// integrated to the main collection.
async getUser (id) {
return (await this._getUser(id)).properties
const user = (await this._getUser(id)).properties
// TODO: remove when no longer the email property has been
// completely eradicated.
user.name = user.email
return user
}
async getUserByName (username, returnNullIfMissing) {