Unify getMapConfig interface

This commit is contained in:
Raul Ochoa 2016-05-23 16:20:42 +02:00
parent 6ccdb6cefd
commit 12c44fda6f
3 changed files with 11 additions and 3 deletions

View File

@ -136,6 +136,10 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
var mapConfig;
var analysesResults = [];
var user = req.context.user;
var params = req.params;
var context = {};
step(
function setupParams(){
self.req2params(req, this);
@ -143,7 +147,7 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
prepareConfigFn,
function prepareSqlWrap(err, requestMapConfig) {
assert.ifError(err);
self.sqlWrapMapConfigAdapter.getMapConfig(requestMapConfig, this);
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, params, context, this);
},
function prepareAnalysisLayers(err, requestMapConfig) {
assert.ifError(err);

View File

@ -4,7 +4,7 @@ function SqlWrapMapConfigAdapter() {
module.exports = SqlWrapMapConfigAdapter;
SqlWrapMapConfigAdapter.prototype.getMapConfig = function(requestMapConfig, callback) {
SqlWrapMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfig, params, context, callback) {
if (requestMapConfig && Array.isArray(requestMapConfig.layers)) {
requestMapConfig.layers = requestMapConfig.layers.map(function(layer) {
if (layer.options) {

View File

@ -60,6 +60,10 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
var rendererParams;
var apiKey;
var user = this.owner;
var params = this.params;
var context = {};
step(
function getTemplate() {
self.getTemplate(this);
@ -99,7 +103,7 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
},
function prepareSqlWrap(err, requestMapConfig) {
assert.ifError(err);
self.sqlWrapMapConfigAdapter.getMapConfig(requestMapConfig, this);
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, params, context, this);
},
function prepareAnalysisLayers(err, requestMapConfig) {
assert.ifError(err);