From 921e35954d1a4e9ee663cc6cec362e87c156308b Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 21 Apr 2014 11:13:03 -0700 Subject: [PATCH 1/4] Rename the method so that it won't conflict with Model.checkAccess See https://github.com/strongloop/loopback/issues/239 --- lib/models/acl.js | 6 +++--- test/acl.test.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/models/acl.js b/lib/models/acl.js index d7f18b6f..b14ebabc 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -356,7 +356,7 @@ ACL.prototype.debug = function() { * @property {String} accessType The access type * @param {Function} callback */ -ACL.checkAccess = function (context, callback) { +ACL.checkAccessForContext = function (context, callback) { if(!(context instanceof AccessContext)) { context = new AccessContext(context); } @@ -422,7 +422,7 @@ ACL.checkAccess = function (context, callback) { if(resolved && resolved.permission === ACL.DEFAULT) { resolved.permission = (model && model.settings.defaultPermission) || ACL.ALLOW; } - debug('checkAccess() returns: %j', resolved); + debug('checkAccessForContext() returns: %j', resolved); callback && callback(null, resolved); }); }); @@ -455,7 +455,7 @@ ACL.checkAccessForToken = function (token, model, modelId, method, callback) { context.debug(); - this.checkAccess(context, function (err, access) { + this.checkAccessForContext(context, function (err, access) { if (err) { callback && callback(err); return; diff --git a/test/acl.test.js b/test/acl.test.js index 488638e7..ce75a12b 100644 --- a/test/acl.test.js +++ b/test/acl.test.js @@ -268,7 +268,7 @@ describe('security ACLs', function () { log('ACL 2: ', acl.toObject()); - ACL.checkAccess({ + ACL.checkAccessForContext({ principals: [ {type: ACL.USER, id: userId} ], @@ -279,7 +279,7 @@ describe('security ACLs', function () { assert(!err && access.permission === ACL.ALLOW); }); - ACL.checkAccess({ + ACL.checkAccessForContext({ principals: [ {type: ACL.ROLE, id: Role.EVERYONE} ], From e9d7b54ec673d2f801d03d62f7edb1adca4244dc Mon Sep 17 00:00:00 2001 From: crandmck Date: Wed, 23 Apr 2014 14:40:00 -0700 Subject: [PATCH 2/4] Remove intermediate section headers from nav --- docs.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs.json b/docs.json index 63968119..805f38ca 100644 --- a/docs.json +++ b/docs.json @@ -2,9 +2,7 @@ "title": "LoopBack Documentation", "content": [ "lib/application.js", - {"title": "LoopBack", "depth": 3}, "lib/loopback.js", - {"title": "Middleware", "depth": 3}, "lib/middleware/token.js", "lib/models/access-token.js", "lib/models/access-context.js", From 1676ac6e58204fa49716043f98b048537573ab3d Mon Sep 17 00:00:00 2001 From: crandmck Date: Wed, 23 Apr 2014 15:20:18 -0700 Subject: [PATCH 3/4] Fix constructor JSDoc --- lib/models/access-context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/access-context.js b/lib/models/access-context.js index 72b24810..b748db1b 100644 --- a/lib/models/access-context.js +++ b/lib/models/access-context.js @@ -7,6 +7,7 @@ var debug = require('debug')('loopback:security:access-context'); * resources * * @class + * @options {Object} context The context object * @property {Principal[]} principals An array of principals * @property {Function} model The model class * @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 {AccessToken} accessToken The access token * - * @param {Object} context The context object * @returns {AccessContext} * @constructor */ From 25599c0fb4ceac7e0cb8977b72bf8adbaaba08e8 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Thu, 24 Apr 2014 10:30:35 -0700 Subject: [PATCH 4/4] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5152940..1ed4687e 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "Platform", "mBaaS" ], - "version": "1.8.0", + "version": "1.8.1", "scripts": { "test": "mocha -R spec" },