Fix the Role ref to RoleMapping

This commit is contained in:
Raymond Feng 2014-01-23 15:04:48 -08:00
parent 224b500c3a
commit 5586c54c49
1 changed files with 1 additions and 3 deletions

View File

@ -112,8 +112,6 @@ var Role = loopback.createModel('Role', RoleSchema, {
}
});
Role.RoleMapping = RoleMapping;
// Set up the connection to users/applications/roles once the model
Role.once('dataSourceAttached', function () {
var roleMappingModel = this.RoleMapping || loopback.getModelByType(RoleMapping);
@ -338,7 +336,7 @@ Role.isInRole = function (role, context, callback) {
return;
}
var roleMappingModel = this.RoleMapping || RoleMapping;
var roleMappingModel = this.RoleMapping || loopback.getModelByType(RoleMapping);
this.findOne({where: {name: role}}, function (err, result) {
if (err) {
callback && callback(err);