diff --git a/lib/models/role.js b/lib/models/role.js index 7d583043..e249f780 100644 --- a/lib/models/role.js +++ b/lib/models/role.js @@ -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);