control API access grants

This commit is contained in:
Eneko Lakasta
2018-02-08 13:07:25 +01:00
parent b82d26527a
commit e1a2ee2381
4 changed files with 50 additions and 2 deletions
+9
View File
@@ -81,6 +81,15 @@ AuthApi.prototype.authorizedByAPIKey = function(user, req, callback) {
return callback(error);
}
if (!apikey.grantsMaps) {
const error = new Error('Forbidden');
error.type = 'auth';
error.subtype = 'api-key-does-not-grant-access';
error.http_status = 403;
return callback(error);
}
return callback(null, true);
});
};