Merge pull request #86 from strongloop/feature/model-require-token

Feature/model require token
This commit is contained in:
Ritchie Martori 2013-12-06 13:03:24 -08:00
commit 4e1e3afb74
1 changed files with 13 additions and 1 deletions

View File

@ -186,7 +186,11 @@ app.enableAuth = function() {
}
}
);
} else if(method.fn && method.fn.requireToken === false) {
} else if(
Model.requireToken === false ||
Model.settings.requireToken === false ||
method.fn && method.fn.requireToken === false
) {
next();
} else {
var e = new Error('Access Denied');
@ -282,6 +286,14 @@ app.boot = function(options) {
}
}
// disable token requirement for swagger, if available
var swagger = app.remotes().exports.swagger;
var requireTokenForSwagger = appConfig.swagger
&& appConfig.swagger.requireToken;
if(swagger) {
swagger.requireToken = requireTokenForSwagger || false;
}
// require directories
var requiredModels = requireDir(path.join(appRootDir, 'models'));
}