From 1ed4e2b9d7a8272cb94e226e4e9d1ffe26eb122e Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Mon, 11 Aug 2014 10:55:23 -0700 Subject: [PATCH 1/6] Fix accessToken property docs --- lib/models/access-token.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/models/access-token.js b/lib/models/access-token.js index 47b7a13d..6917a3b4 100644 --- a/lib/models/access-token.js +++ b/lib/models/access-token.js @@ -27,15 +27,15 @@ var properties = { /** * Token based authentication and access control. * - * @property id {String} Generated token ID - * @property ttl {Number} Time to live - * @property created {Date} When the token was created - * * **Default ACLs** * * - DENY EVERYONE `*` * - ALLOW EVERYONE create - * + * + * @property {String} id Generated token ID + * @property {Number} ttl Time to live in seconds + * @property {Date} created When the token was created + * * @class * @inherits {Model} */ From d82d789ffa4174be39d73342a9506f9ae50abdc5 Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Mon, 11 Aug 2014 10:55:34 -0700 Subject: [PATCH 2/6] 2.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 037be4c2..453d0a5b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "mobile", "mBaaS" ], - "version": "2.1.1", + "version": "2.1.2", "scripts": { "test": "grunt mocha-and-karma" }, From d93b6127c407bf52158a5bafdbd5cc48e0ec2557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 25 Jul 2014 11:00:22 +0200 Subject: [PATCH 3/6] Remove `req.resume` from `app.enableAuth` Remove `req.pause` and `req.resume` from `app.enableAuth` - they are no longer needed, the request starts paused and there is no other middleware that would resume it before us. - when we resume the request after authentication, we force all other async operations (like sharedCtor) to call pause & resume too, otherwise data are lost --- lib/application.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/application.js b/lib/application.js index 6fda62f3..b9facad0 100644 --- a/lib/application.js +++ b/lib/application.js @@ -316,17 +316,12 @@ app.enableAuth = function() { } if(Model.checkAccess) { - // Pause the request before checking access - // See https://github.com/strongloop/loopback-storage-service/issues/7 - req.pause(); Model.checkAccess( req.accessToken, modelId, method, ctx, function(err, allowed) { - // Emit any cached data events that fired while checking access. - req.resume(); if(err) { console.log(err); next(err); From 066e87300d59b589046f557f0edf33402639a84a Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 12 Aug 2014 15:03:15 +0200 Subject: [PATCH 4/6] add count to relations and scopes Signed-off-by: Jaka Hudoklin --- lib/models/model.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/models/model.js b/lib/models/model.js index 99d899b4..6694ac55 100644 --- a/lib/models/model.js +++ b/lib/models/model.js @@ -503,6 +503,13 @@ Model.scopeRemoting = function(scopeName, scope, define) { http: {verb: 'delete', path: '/' + pathName}, description: 'Deletes all ' + scopeName + ' of this model.' }); + + define('__count__' + scopeName, { + isStatic: isStatic, + http: {verb: 'get', path: '/' + pathName + '/count'}, + description: 'Counts ' + scopeName + ' of ' + this.modelName + '.', + returns: {arg: 'count', type: 'number', root: true} + }); }; Model.nestRemoting = function(relationName, options, cb) { From c3a33df0cec1997cf1b29d1da5471dc0f5ad9aa4 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 18 Aug 2014 21:44:28 -0700 Subject: [PATCH 5/6] Make sure AccessToken extends from PersistedModel --- lib/models/access-token.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/models/access-token.js b/lib/models/access-token.js index 6917a3b4..85a9f5f7 100644 --- a/lib/models/access-token.js +++ b/lib/models/access-token.js @@ -2,8 +2,7 @@ * Module Dependencies. */ -var Model = require('../loopback').Model - , loopback = require('../loopback') +var loopback = require('../loopback') , assert = require('assert') , crypto = require('crypto') , uid = require('uid2') @@ -37,10 +36,11 @@ var properties = { * @property {Date} created When the token was created * * @class - * @inherits {Model} + * @inherits {PersistedModel} */ -var AccessToken = module.exports = Model.extend('AccessToken', properties, { +var AccessToken = module.exports = + loopback.PersistedModel.extend('AccessToken', properties, { acls: [ { principalType: ACL.ROLE, From c28b8707844ee58830b0d9b1718a2b335eae3e30 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 18 Aug 2014 21:49:08 -0700 Subject: [PATCH 6/6] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 453d0a5b..211653af 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "mobile", "mBaaS" ], - "version": "2.1.2", + "version": "2.1.3", "scripts": { "test": "grunt mocha-and-karma" },