Merge pull request #3107 from benkroeger/master

Role model: resolve related models by name
This commit is contained in:
Miroslav Bajtoš 2017-01-25 10:48:15 +01:00 committed by GitHub
commit dfa1f6035b
2 changed files with 3 additions and 6 deletions

View File

@ -24,9 +24,9 @@ module.exports = function(Role) {
Role.resolveRelatedModels = function() {
if (!this.userModel) {
var reg = this.registry;
this.roleMappingModel = reg.getModelByType(loopback.RoleMapping);
this.userModel = reg.getModelByType(loopback.User);
this.applicationModel = reg.getModelByType(loopback.Application);
this.roleMappingModel = reg.getModelByType('RoleMapping');
this.userModel = reg.getModelByType('User');
this.applicationModel = reg.getModelByType('Application');
}
};

View File

@ -47,9 +47,6 @@ describe('role model', function() {
ACL.roleMappingModel = RoleMapping;
ACL.userModel = User;
ACL.applicationModel = Application;
Role.roleMappingModel = RoleMapping;
Role.userModel = User;
Role.applicationModel = Application;
});
it('should define role/role relations', function(done) {