Merge pull request #97 from strongloop/bug/check-access

Dont attempt access checking on models without a check access method
This commit is contained in:
Ritchie Martori 2013-12-12 16:01:33 -08:00
commit 591ed86444
1 changed files with 20 additions and 16 deletions

View File

@ -164,6 +164,7 @@ app.enableAuth = function() {
var modelInstance = ctx.instance;
var modelId = modelInstance && modelInstance.id || req.param('id');
if(Model.checkAccess) {
Model.checkAccess(
req.accessToken,
modelId,
@ -181,6 +182,9 @@ app.enableAuth = function() {
}
}
);
} else {
next();
}
});
}