Role model: resolves related models by name
Resolve models related to the `Role` model by name instead of class.
This commit is contained in:
parent
b2a00286a3
commit
56ad85ae2a
|
@ -36,9 +36,9 @@ module.exports = function(Role) {
|
||||||
Role.resolveRelatedModels = function() {
|
Role.resolveRelatedModels = function() {
|
||||||
if (!this.userModel) {
|
if (!this.userModel) {
|
||||||
var reg = this.registry;
|
var reg = this.registry;
|
||||||
this.roleMappingModel = reg.getModelByType(loopback.RoleMapping);
|
this.roleMappingModel = reg.getModelByType('RoleMapping');
|
||||||
this.userModel = reg.getModelByType(loopback.User);
|
this.userModel = reg.getModelByType('User');
|
||||||
this.applicationModel = reg.getModelByType(loopback.Application);
|
this.applicationModel = reg.getModelByType('Application');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,6 @@ describe('role model', function() {
|
||||||
ACL.roleMappingModel = RoleMapping;
|
ACL.roleMappingModel = RoleMapping;
|
||||||
ACL.userModel = User;
|
ACL.userModel = User;
|
||||||
ACL.applicationModel = Application;
|
ACL.applicationModel = Application;
|
||||||
Role.roleMappingModel = RoleMapping;
|
|
||||||
Role.userModel = User;
|
|
||||||
Role.applicationModel = Application;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should define role/role relations', function(done) {
|
it('should define role/role relations', function(done) {
|
||||||
|
|
Loading…
Reference in New Issue