Pause the req before checking access
See https://github.com/strongloop/loopback-storage-service/issues/7
This commit is contained in:
parent
f031e79392
commit
32a9131004
|
@ -279,11 +279,16 @@ app.enableAuth = function() {
|
|||
var modelId = modelInstance && modelInstance.id || req.param('id');
|
||||
|
||||
if(Model.checkAccess) {
|
||||
// Pause the request before checking access
|
||||
// See https://github.com/strongloop/loopback-storage-service/issues/7
|
||||
req.pause();
|
||||
Model.checkAccess(
|
||||
req.accessToken,
|
||||
modelId,
|
||||
method.name,
|
||||
function(err, allowed) {
|
||||
// Emit any cached data events that fired while checking access.
|
||||
req.resume();
|
||||
if(err) {
|
||||
console.log(err);
|
||||
next(err);
|
||||
|
|
Loading…
Reference in New Issue