remove functionality from parseMetadataToDatabase. DB user and pass not longer needed

This commit is contained in:
Eneko Lakasta 2018-06-05 17:58:55 +02:00
parent 4993f8a956
commit 62df0a387a

View File

@ -1,7 +1,5 @@
'use strict'; 'use strict';
var _ = require('underscore');
function UserDatabaseMetadataService(metadataBackend) { function UserDatabaseMetadataService(metadataBackend) {
this.metadataBackend = metadataBackend; this.metadataBackend = metadataBackend;
} }
@ -18,26 +16,14 @@ UserDatabaseMetadataService.prototype.getUserMetadata = function (username, call
}); });
}; };
//TODO AUTH is (all of) this necessary?
UserDatabaseMetadataService.prototype.parseMetadataToDatabase = function (userDatabaseMetadata) { UserDatabaseMetadataService.prototype.parseMetadataToDatabase = function (userDatabaseMetadata) {
var dbParams = userDatabaseMetadata; var dbParams = userDatabaseMetadata;
var dbopts = {}; var dbopts = {};
dbopts.pass = dbParams.dbpass || global.settings.db_pubuser_pass;
dbopts.port = dbParams.dbport || global.settings.db_batch_port || global.settings.db_port; dbopts.port = dbParams.dbport || global.settings.db_batch_port || global.settings.db_port;
dbopts.host = dbParams.dbhost; dbopts.host = dbParams.dbhost;
dbopts.dbname = dbParams.dbname; dbopts.dbname = dbParams.dbname;
dbopts.user = (!!dbParams.dbpublicuser) ? dbParams.dbpublicuser : global.settings.db_pubuser;
// batch is secure so it's going to be master by default
dbopts.authorizationLevel = 'master';
dbopts.user = _.template(global.settings.db_user, { user_id: dbParams.dbuser });
dbopts.pass = _.template(global.settings.db_user_pass, {
user_id: dbParams.dbuser,
user_password: dbParams.dbpass
});
return dbopts; return dbopts;
}; };