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');
|
var modelId = modelInstance && modelInstance.id || req.param('id');
|
||||||
|
|
||||||
if(Model.checkAccess) {
|
if(Model.checkAccess) {
|
||||||
|
// Pause the request before checking access
|
||||||
|
// See https://github.com/strongloop/loopback-storage-service/issues/7
|
||||||
|
req.pause();
|
||||||
Model.checkAccess(
|
Model.checkAccess(
|
||||||
req.accessToken,
|
req.accessToken,
|
||||||
modelId,
|
modelId,
|
||||||
method.name,
|
method.name,
|
||||||
function(err, allowed) {
|
function(err, allowed) {
|
||||||
|
// Emit any cached data events that fired while checking access.
|
||||||
|
req.resume();
|
||||||
if(err) {
|
if(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
next(err);
|
next(err);
|
||||||
|
|
Loading…
Reference in New Issue