From ec24019cc06a594e8d75563c57e741cc4b11364e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 22 Feb 2018 17:35:03 +0100 Subject: [PATCH] Apply some ES6 goodies --- app/services/user_database_service.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/services/user_database_service.js b/app/services/user_database_service.js index a8099ac1..c762e246 100644 --- a/app/services/user_database_service.js +++ b/app/services/user_database_service.js @@ -1,6 +1,4 @@ -'use strict'; - -var _ = require('underscore'); +const _ = require('underscore'); function isApiKeyFound(apikey) { return apikey.type !== null && @@ -23,7 +21,7 @@ function UserDatabaseService(metadataBackend) { * @param {String} cdbUsername * @param {Function} callback (err, dbParams, authDbParams) */ -UserDatabaseService.prototype.getConnectionParams = function (cdbUsername, apikeyToken, isAuthenticated, callback) { +UserDatabaseService.prototype.getConnectionParams = function (cdbUsername, apikeyToken, authenticated, callback) { this.metadataBackend.getAllUserDBParams(cdbUsername, (err, dbParams) => { if (err) { err.http_status = 404; @@ -41,8 +39,8 @@ UserDatabaseService.prototype.getConnectionParams = function (cdbUsername, apike dbopts.dbname = dbParams.dbname; dbopts.user = (!!dbParams.dbpublicuser) ? dbParams.dbpublicuser : global.settings.db_pubuser; - var user = _.template(global.settings.db_user, {user_id: dbParams.dbuser}); - var pass = null; + const user = _.template(global.settings.db_user, {user_id: dbParams.dbuser}); + let pass = null; if (global.settings.hasOwnProperty('db_user_pass')) { pass = _.template(global.settings.db_user_pass, { @@ -51,7 +49,7 @@ UserDatabaseService.prototype.getConnectionParams = function (cdbUsername, apike }); } - if (isAuthenticated) { + if (authenticated) { dbopts.user = user; dbopts.pass = pass; }