Skip to content

Commit

Permalink
Merge branch 'release/2.1.3' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Feng committed Aug 19, 2014
2 parents dfd7d41 + c28b870 commit 2a952c4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
5 changes: 0 additions & 5 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 9 additions & 9 deletions lib/models/access-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions lib/models/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"mobile",
"mBaaS"
],
"version": "2.1.1",
"version": "2.1.3",
"scripts": {
"test": "grunt mocha-and-karma"
},
Expand Down

0 comments on commit 2a952c4

Please sign in to comment.