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) {
// 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);

View File

@ -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')
@ -27,20 +26,21 @@ 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}
* @inherits {PersistedModel}
*/
var AccessToken = module.exports = Model.extend('AccessToken', properties, {
var AccessToken = module.exports =
loopback.PersistedModel.extend('AccessToken', properties, {
acls: [
{
principalType: ACL.ROLE,

View File

@ -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) {

View File

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