Add more detailed profile info about the "authorize" step

Closes #142
This commit is contained in:
Sandro Santilli 2014-02-13 10:25:28 +01:00
parent e88e49001a
commit b673cb2a1f

View File

@ -521,6 +521,7 @@ module.exports = function(){
that.authorizedByAPIKey(req, this);
},
function checkApiKey(err, authorized){
if (req.profiler) req.profiler.done('authorizedByAPIKey');
if (err) throw err;
// if not authorized by api_key, continue
@ -540,6 +541,13 @@ module.exports = function(){
},
function checkSignAuthorized(err, signed_by){
if (err) throw err;
if (req.profiler) {
if ( req.params._authorizedByApiKey ) {
req.profiler.done('setDBAuth');
} else {
req.profiler.done('authorizedBySigner');
}
}
if ( ! signed_by ) {
// request not authorized by signer, continue
@ -549,6 +557,7 @@ module.exports = function(){
// Authorized by "signed_by" !
that.setDBAuth(signed_by, req.params, function(err) {
if (req.profiler) req.profiler.done('setDBAuth');
callback(err, true); // authorized (or error)
});
},
@ -559,9 +568,11 @@ module.exports = function(){
},
function getPrivacy(err, dbname){
if (err) throw err;
if (req.profiler) req.profiler.done('tablePrivacy.getUserDBName');
cartoData.getTablePrivacy(dbname, req.params.table, this);
},
function(err, privacy){
if (req.profiler) req.profiler.done('getTablePrivacy');
callback(err, privacy);
}
);