Merge pull request #648 from strongloop/fix/missing-loopback-var
Fix places using undefined variables
This commit is contained in:
commit
85fd27a492
|
@ -8,6 +8,5 @@
|
||||||
"maxlen": 80,
|
"maxlen": 80,
|
||||||
"trailing": true,
|
"trailing": true,
|
||||||
"newcap": true,
|
"newcap": true,
|
||||||
"nonew": true,
|
"nonew": true
|
||||||
"undef": false
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var loopback = require('../../lib/loopback');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `RoleMapping` model extends from the built in `loopback.Model` type.
|
* The `RoleMapping` model extends from the built in `loopback.Model` type.
|
||||||
*
|
*
|
||||||
|
@ -59,7 +61,8 @@ module.exports = function(RoleMapping) {
|
||||||
*/
|
*/
|
||||||
RoleMapping.prototype.childRole = function (callback) {
|
RoleMapping.prototype.childRole = function (callback) {
|
||||||
if (this.principalType === RoleMapping.ROLE) {
|
if (this.principalType === RoleMapping.ROLE) {
|
||||||
var roleModel = this.constructor.Role || loopback.getModelByType(Role);
|
var roleModel = this.constructor.Role ||
|
||||||
|
loopback.getModelByType(loopback.Role);
|
||||||
roleModel.findById(this.principalId, callback);
|
roleModel.findById(this.principalId, callback);
|
||||||
} else {
|
} else {
|
||||||
process.nextTick(function () {
|
process.nextTick(function () {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
var loopback = require('../../lib/loopback');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource owner grants/delegates permissions to client applications
|
* Resource owner grants/delegates permissions to client applications
|
||||||
|
|
|
@ -473,7 +473,7 @@ User.setup = function() {
|
||||||
if (ctx.req) {
|
if (ctx.req) {
|
||||||
ctx.res.redirect(ctx.req.param('redirect'));
|
ctx.res.redirect(ctx.req.param('redirect'));
|
||||||
} else {
|
} else {
|
||||||
fn(new Error('transport unsupported'));
|
next(new Error('transport unsupported'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
2
index.js
2
index.js
|
@ -19,4 +19,4 @@ loopback.Remote = require('loopback-connector-remote');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
loopback.GeoPoint = require('loopback-datasource-juggler/lib/geo').GeoPoint;
|
loopback.GeoPoint = require('loopback-datasource-juggler/lib/geo').GeoPoint;
|
||||||
loopback.ValidationError = datasourceJuggler.ValidationError;
|
loopback.ValidationError = loopback.Model.ValidationError;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
var assert = require('assert');
|
||||||
var loopback = require('./loopback');
|
var loopback = require('./loopback');
|
||||||
var debug = require('debug')('loopback:security:access-context');
|
var debug = require('debug')('loopback:security:access-context');
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ Model._ACL = function getACL(ACL) {
|
||||||
if(_aclModel) {
|
if(_aclModel) {
|
||||||
return _aclModel;
|
return _aclModel;
|
||||||
}
|
}
|
||||||
var aclModel = loopback.ACL;
|
var aclModel = registry.getModel('ACL');
|
||||||
_aclModel = registry.getModelByType(aclModel);
|
_aclModel = registry.getModelByType(aclModel);
|
||||||
return _aclModel;
|
return _aclModel;
|
||||||
};
|
};
|
||||||
|
@ -268,7 +268,7 @@ Model._ACL = function getACL(ACL) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Model.checkAccess = function(token, modelId, sharedMethod, ctx, callback) {
|
Model.checkAccess = function(token, modelId, sharedMethod, ctx, callback) {
|
||||||
var ANONYMOUS = loopback.AccessToken.ANONYMOUS;
|
var ANONYMOUS = registry.getModel('AccessToken').ANONYMOUS;
|
||||||
token = token || ANONYMOUS;
|
token = token || ANONYMOUS;
|
||||||
var aclModel = Model._ACL();
|
var aclModel = Model._ACL();
|
||||||
|
|
||||||
|
@ -714,6 +714,8 @@ Model.nestRemoting = function(relationName, options, cb) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Model.ValidationError = require('loopback-datasource-juggler').ValidationError;
|
||||||
|
|
||||||
// setup the initial model
|
// setup the initial model
|
||||||
Model.setup();
|
Model.setup();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Model = require('./model');
|
var Model = require('./model');
|
||||||
|
var registry = require('./registry');
|
||||||
var runtime = require('./runtime');
|
var runtime = require('./runtime');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
|
@ -322,7 +323,7 @@ PersistedModel.prototype.save = function (options, callback) {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
save();
|
save();
|
||||||
} else {
|
} else {
|
||||||
var err = new ValidationError(inst);
|
var err = new Model.ValidationError(inst);
|
||||||
// throws option is dangerous for async usage
|
// throws option is dangerous for async usage
|
||||||
if (options.throws) {
|
if (options.throws) {
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -700,13 +701,13 @@ PersistedModel.changes = function(since, filter, callback) {
|
||||||
checkpoint: {gt: since},
|
checkpoint: {gt: since},
|
||||||
modelName: this.modelName
|
modelName: this.modelName
|
||||||
}, function(err, changes) {
|
}, function(err, changes) {
|
||||||
if(err) return cb(err);
|
if(err) return callback(err);
|
||||||
var ids = changes.map(function(change) {
|
var ids = changes.map(function(change) {
|
||||||
return change.getModelId();
|
return change.getModelId();
|
||||||
});
|
});
|
||||||
filter.where[idName] = {inq: ids};
|
filter.where[idName] = {inq: ids};
|
||||||
model.find(filter, function(err, models) {
|
model.find(filter, function(err, models) {
|
||||||
if(err) return cb(err);
|
if(err) return callback(err);
|
||||||
var modelIds = models.map(function(m) {
|
var modelIds = models.map(function(m) {
|
||||||
return m[idName].toString();
|
return m[idName].toString();
|
||||||
});
|
});
|
||||||
|
@ -1016,7 +1017,7 @@ PersistedModel.enableChangeTracking = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistedModel._defineChangeModel = function() {
|
PersistedModel._defineChangeModel = function() {
|
||||||
var BaseChangeModel = loopback.Change;
|
var BaseChangeModel = registry.getModel('Change');
|
||||||
assert(BaseChangeModel,
|
assert(BaseChangeModel,
|
||||||
'Change model must be defined before enabling change replication');
|
'Change model must be defined before enabling change replication');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue