Windshaft-cartodb/lib/models/mapconfig/provider/create-layergroup-provider.js

30 lines
969 B
JavaScript
Raw Normal View History

'use strict';
2018-05-30 23:02:15 +08:00
const MapStoreMapConfigProvider = require('./map-store-provider');
2015-07-11 01:10:55 +08:00
2018-05-31 02:28:15 +08:00
module.exports = class CreateLayergroupMapConfigProvider extends MapStoreMapConfigProvider {
constructor (mapConfig, user, userLimitsBackend, pgConnection, affectedTablesCache, params) {
super(null, user, userLimitsBackend, pgConnection, affectedTablesCache, params);
2018-05-31 02:28:15 +08:00
this.mapConfig = mapConfig;
2018-03-22 02:08:37 +08:00
}
2018-05-31 02:28:15 +08:00
getMapConfig (callback) {
if (this.mapConfig && this.params && this.context) {
return callback(null, this.mapConfig, this.params, this.context);
2015-07-11 01:10:55 +08:00
}
2018-05-30 23:00:15 +08:00
2018-05-31 02:28:15 +08:00
const context = {};
2015-07-11 01:10:55 +08:00
2018-05-31 02:28:15 +08:00
this.userLimitsBackend.getRenderLimits(this.user, this.params.api_key, (err, renderLimits) => {
if (err) {
return callback(err);
}
2015-07-11 01:10:55 +08:00
2018-05-31 02:28:15 +08:00
context.limits = renderLimits;
this.context = context;
2018-05-31 02:28:15 +08:00
return callback(null, this.mapConfig, this.params, context);
});
}
2018-04-06 18:59:53 +08:00
};