Removes map_metadata endpoint

This commit is contained in:
Raul Ochoa 2015-02-10 00:08:08 +01:00
parent ba0f394a48
commit a4eade31a2
3 changed files with 0 additions and 103 deletions

View File

@ -166,26 +166,6 @@ var CartodbWindshaft = function(serverOptions) {
* END Routing
******************************************************************************************************************/
/**
* Helper to allow access to metadata to be used in embedded maps.
*/
ws.get(serverOptions.base_url + '/map_metadata', function(req, res){
ws.doCORS(res);
Step(
function(){
serverOptions.getMapMetadata(req, this);
},
function(err, data){
if (err){
ws.sendError(res, {error: err.message}, 500, 'GET MAP_METADATA', err);
//ws.sendResponse(res, [err.message, 500]);
} else {
ws.sendResponse(res, [{map_metadata: data}, 200]);
}
}
);
});
/**
* Helper API to allow per table tile cache (and sql cache) to be invalidated remotely.
* Keep endpoint for backwards compatibility

View File

@ -766,34 +766,5 @@ module.exports = function(redisPool) {
);
};
/**
* Little helper method to get map metadata and return to client
* @param req
* @param callback
*/
me.getMapMetadata = function(req, callback){
var that = this;
var user = me.userByReq(req);
Step(
function(){
// TODO: if this step really needed ?
that.req2params(req, this);
},
function getDatabase(err){
if (err) throw err;
cartoData.getUserDBName(user, this);
},
function getMapMetadata(err, dbname){
if (err) throw err;
cartoData.getTableMapMetadata(dbname, req.params.table, this);
},
function(err, data){
callback(err, data);
}
);
};
return me;
};

View File

@ -1208,60 +1208,6 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
});
});
/////////////////////////////////////////////////////////////////////////////////
//
// GET METADATA
//
/////////////////////////////////////////////////////////////////////////////////
test("does not provide metadata of private table to unauthenticated requests", function(done){
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/test_table_private_1/map_metadata',
method: 'GET'
},{}, function(res) {
// FIXME: should be 403 instead
assert.equal(res.statusCode, 500, res.statusCode + ': ' + res.body);
assert.ok(!res.headers.hasOwnProperty('cache-control'));
done();
});
});
test("does provide metadata of private table to authenticated requests", function(done){
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/test_table_private_1/map_metadata?map_key=1234',
method: 'GET'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
done();
});
});
test("does provide metadata of public table to unauthenticated requests", function(done){
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/gadm4/map_metadata',
method: 'GET'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
// TODO: show metadata ?
done();
});
});
test("does provide metadata of public table to authenticated requests", function(done){
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/gadm4/map_metadata?map_key=1234',
method: 'GET'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
// TODO: show metadata ?
done();
});
});
/////////////////////////////////////////////////////////////////////////////////
//
// DELETE CACHE