Merge branch 'release/2.1.3' into production

This commit is contained in:
Raymond Feng 2014-08-18 21:49:48 -07:00
commit 2a952c45b6
4 changed files with 17 additions and 15 deletions

View File

@ -316,17 +316,12 @@ app.enableAuth = function() {
} }
if(Model.checkAccess) { if(Model.checkAccess) {
// Pause the request before checking access
// See https://github.com/strongloop/loopback-storage-service/issues/7
req.pause();
Model.checkAccess( Model.checkAccess(
req.accessToken, req.accessToken,
modelId, modelId,
method, method,
ctx, ctx,
function(err, allowed) { function(err, allowed) {
// Emit any cached data events that fired while checking access.
req.resume();
if(err) { if(err) {
console.log(err); console.log(err);
next(err); next(err);

View File

@ -2,8 +2,7 @@
* Module Dependencies. * Module Dependencies.
*/ */
var Model = require('../loopback').Model var loopback = require('../loopback')
, loopback = require('../loopback')
, assert = require('assert') , assert = require('assert')
, crypto = require('crypto') , crypto = require('crypto')
, uid = require('uid2') , uid = require('uid2')
@ -27,20 +26,21 @@ var properties = {
/** /**
* Token based authentication and access control. * 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** * **Default ACLs**
* *
* - DENY EVERYONE `*` * - DENY EVERYONE `*`
* - ALLOW EVERYONE create * - 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 * @class
* @inherits {Model} * @inherits {PersistedModel}
*/ */
var AccessToken = module.exports = Model.extend('AccessToken', properties, { var AccessToken = module.exports =
loopback.PersistedModel.extend('AccessToken', properties, {
acls: [ acls: [
{ {
principalType: ACL.ROLE, principalType: ACL.ROLE,

View File

@ -503,6 +503,13 @@ Model.scopeRemoting = function(scopeName, scope, define) {
http: {verb: 'delete', path: '/' + pathName}, http: {verb: 'delete', path: '/' + pathName},
description: 'Deletes all ' + scopeName + ' of this model.' 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) { Model.nestRemoting = function(relationName, options, cb) {

View File

@ -26,7 +26,7 @@
"mobile", "mobile",
"mBaaS" "mBaaS"
], ],
"version": "2.1.1", "version": "2.1.3",
"scripts": { "scripts": {
"test": "grunt mocha-and-karma" "test": "grunt mocha-and-karma"
}, },