Skip to content

Commit 97f96f4

Browse files
authored
Merge pull request #3135 from strongloop/backport/fix-role-models-resolution
Role model: resolve related models by name
2 parents b2a0028 + 56ad85a commit 97f96f4

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

common/models/role.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ module.exports = function(Role) {
3636
Role.resolveRelatedModels = function() {
3737
if (!this.userModel) {
3838
var reg = this.registry;
39-
this.roleMappingModel = reg.getModelByType(loopback.RoleMapping);
40-
this.userModel = reg.getModelByType(loopback.User);
41-
this.applicationModel = reg.getModelByType(loopback.Application);
39+
this.roleMappingModel = reg.getModelByType('RoleMapping');
40+
this.userModel = reg.getModelByType('User');
41+
this.applicationModel = reg.getModelByType('Application');
4242
}
4343
};
4444

test/role.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ describe('role model', function() {
4545
ACL.roleMappingModel = RoleMapping;
4646
ACL.userModel = User;
4747
ACL.applicationModel = Application;
48-
Role.roleMappingModel = RoleMapping;
49-
Role.userModel = User;
50-
Role.applicationModel = Application;
5148
});
5249

5350
it('should define role/role relations', function(done) {

0 commit comments

Comments
 (0)