Do not use underscore

This commit is contained in:
Daniel García Aubert 2018-02-19 14:41:06 +01:00
parent e04529c501
commit 633d06bf2d

View File

@ -1,19 +1,15 @@
'use strict'; const AuthApi = require('../auth/auth_api');
var _ = require('underscore');
var AuthApi = require('../auth/auth_api');
module.exports = function authenticatedRequest (userDatabaseService, forceToBeAuthenticated = false) { module.exports = function authenticatedRequest (userDatabaseService, forceToBeAuthenticated = false) {
return function authenticatedRequestMiddleware (req, res, next) { return function authenticatedRequestMiddleware (req, res, next) {
req.profiler.start('sqlapi.job'); const params = Object.assign({}, res.locals, req.query, req.body);
req.profiler.done('init');
const params = _.extend({}, res.locals, req.query, req.body);
const { user } = res.locals; const { user } = res.locals;
const authApi = new AuthApi(req, res, params); const authApi = new AuthApi(req, res, params);
userDatabaseService.getConnectionParams(authApi, user, function (err, dbParams, authDbParams, userLimits) { userDatabaseService.getConnectionParams(authApi, user, function (err, dbParams, authDbParams, userLimits) {
req.profiler.done('setDBAuth'); if (req.profiler) {
req.profiler.done('setDBAuth');
}
if (err) { if (err) {
return next(err); return next(err);