Improve authorizedBySigner
This commit is contained in:
parent
aa266f9b61
commit
e49881d1ed
@ -798,10 +798,9 @@ module.exports = function(serverOptions) {
|
||||
//
|
||||
app.authorizedBySigner = function(req, callback) {
|
||||
if ( ! req.params.token || ! req.params.signer ) {
|
||||
return callback(null, null); // no signer requested
|
||||
return callback(null, false); // no signer requested
|
||||
}
|
||||
|
||||
var signer = req.params.signer;
|
||||
var layergroup_id = req.params.token;
|
||||
var auth_token = req.params.auth_token;
|
||||
|
||||
@ -812,7 +811,7 @@ module.exports = function(serverOptions) {
|
||||
|
||||
var authorized = templateMaps.isAuthorized(mapConfig.obj().template, auth_token);
|
||||
|
||||
return callback(null, authorized ? signer : null);
|
||||
return callback(null, authorized);
|
||||
});
|
||||
};
|
||||
|
||||
@ -877,12 +876,12 @@ module.exports = function(serverOptions) {
|
||||
callback(err, true); // authorized (or error)
|
||||
});
|
||||
},
|
||||
function checkSignAuthorized(err, signed_by){
|
||||
function checkSignAuthorized(err, authorized) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if ( ! signed_by ) {
|
||||
if ( ! authorized ) {
|
||||
// request not authorized by signer.
|
||||
|
||||
// if no signer name was given, let dbparams and
|
||||
@ -896,7 +895,7 @@ module.exports = function(serverOptions) {
|
||||
return callback(null, false);
|
||||
}
|
||||
|
||||
pgConnection.setDBAuth(signed_by, req.params, function(err) {
|
||||
pgConnection.setDBAuth(user, req.params, function(err) {
|
||||
if (req.profiler) {
|
||||
req.profiler.done('setDBAuth');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user