Improve naming for connection database params holder

This commit is contained in:
Daniel García Aubert 2017-11-24 15:45:49 +01:00
parent d13dd9549e
commit c2d1a4653e
2 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ JobController.prototype.createJob = function (req, res) {
var data = {
user: req.context.user,
query: sql,
host: req.context.userDatabase.host
host: req.context.userDbParams.host
};
this.jobService.create(data, jobResponse(req, res, this.statsdClient, 'create', 201));
@ -123,7 +123,7 @@ function jobResponse(req, res, statsdClient, action, status) {
return handleException(err, res);
}
res.header('X-Served-By-DB-Host', req.context.userDatabase.host);
res.header('X-Served-By-DB-Host', req.context.userDbParams.host);
req.profiler.done(action);
req.profiler.end();

View File

@ -14,18 +14,18 @@ function authenticatedMiddleware(userDatabaseService) {
var params = _.extend({}, req.query, body);
var authApi = new AuthApi(req, params);
userDatabaseService.getConnectionParams(authApi, req.context.user, function cancelJob(err, userDatabase) {
userDatabaseService.getConnectionParams(authApi, req.context.user, function cancelJob(err, userDbParams) {
req.profiler.done('setDBAuth');
if (err) {
return handleException(err, res);
}
if (!userDatabase.authenticated) {
if (!userDbParams.authenticated) {
return handleException(new Error('permission denied'), res);
}
req.context.userDatabase = userDatabase;
req.context.userDbParams = userDbParams;
return next(null);
});