Merge branch 'release/1.8.1' into production

This commit is contained in:
Raymond Feng 2014-04-24 10:37:39 -07:00
commit 70715991a9
5 changed files with 7 additions and 9 deletions

View File

@ -2,9 +2,7 @@
"title": "LoopBack Documentation", "title": "LoopBack Documentation",
"content": [ "content": [
"lib/application.js", "lib/application.js",
{"title": "LoopBack", "depth": 3},
"lib/loopback.js", "lib/loopback.js",
{"title": "Middleware", "depth": 3},
"lib/middleware/token.js", "lib/middleware/token.js",
"lib/models/access-token.js", "lib/models/access-token.js",
"lib/models/access-context.js", "lib/models/access-context.js",

View File

@ -7,6 +7,7 @@ var debug = require('debug')('loopback:security:access-context');
* resources * resources
* *
* @class * @class
* @options {Object} context The context object
* @property {Principal[]} principals An array of principals * @property {Principal[]} principals An array of principals
* @property {Function} model The model class * @property {Function} model The model class
* @property {String} modelName The model name * @property {String} modelName The model name
@ -16,7 +17,6 @@ var debug = require('debug')('loopback:security:access-context');
* @property {String} accessType The access type * @property {String} accessType The access type
* @property {AccessToken} accessToken The access token * @property {AccessToken} accessToken The access token
* *
* @param {Object} context The context object
* @returns {AccessContext} * @returns {AccessContext}
* @constructor * @constructor
*/ */

View File

@ -356,7 +356,7 @@ ACL.prototype.debug = function() {
* @property {String} accessType The access type * @property {String} accessType The access type
* @param {Function} callback * @param {Function} callback
*/ */
ACL.checkAccess = function (context, callback) { ACL.checkAccessForContext = function (context, callback) {
if(!(context instanceof AccessContext)) { if(!(context instanceof AccessContext)) {
context = new AccessContext(context); context = new AccessContext(context);
} }
@ -422,7 +422,7 @@ ACL.checkAccess = function (context, callback) {
if(resolved && resolved.permission === ACL.DEFAULT) { if(resolved && resolved.permission === ACL.DEFAULT) {
resolved.permission = (model && model.settings.defaultPermission) || ACL.ALLOW; resolved.permission = (model && model.settings.defaultPermission) || ACL.ALLOW;
} }
debug('checkAccess() returns: %j', resolved); debug('checkAccessForContext() returns: %j', resolved);
callback && callback(null, resolved); callback && callback(null, resolved);
}); });
}); });
@ -455,7 +455,7 @@ ACL.checkAccessForToken = function (token, model, modelId, method, callback) {
context.debug(); context.debug();
this.checkAccess(context, function (err, access) { this.checkAccessForContext(context, function (err, access) {
if (err) { if (err) {
callback && callback(err); callback && callback(err);
return; return;

View File

@ -9,7 +9,7 @@
"Platform", "Platform",
"mBaaS" "mBaaS"
], ],
"version": "1.8.0", "version": "1.8.1",
"scripts": { "scripts": {
"test": "mocha -R spec" "test": "mocha -R spec"
}, },

View File

@ -268,7 +268,7 @@ describe('security ACLs', function () {
log('ACL 2: ', acl.toObject()); log('ACL 2: ', acl.toObject());
ACL.checkAccess({ ACL.checkAccessForContext({
principals: [ principals: [
{type: ACL.USER, id: userId} {type: ACL.USER, id: userId}
], ],
@ -279,7 +279,7 @@ describe('security ACLs', function () {
assert(!err && access.permission === ACL.ALLOW); assert(!err && access.permission === ACL.ALLOW);
}); });
ACL.checkAccess({ ACL.checkAccessForContext({
principals: [ principals: [
{type: ACL.ROLE, id: Role.EVERYONE} {type: ACL.ROLE, id: Role.EVERYONE}
], ],