diff --git a/front/core/directives/specs/acl.spec.js b/front/core/directives/specs/acl.spec.js index 94000d543..09b9eee0b 100644 --- a/front/core/directives/specs/acl.spec.js +++ b/front/core/directives/specs/acl.spec.js @@ -15,6 +15,17 @@ describe('Directive acl', () => { {role: {name: 'myOtherRole'}} ] }); + $httpBackend.whenPOST('Accounts/user/acl').respond([ + { + 'id': 1, + 'model': 'ModelExample', + 'property': '*', + 'accessType': '*', + 'permission': 'ALLOW', + 'principalType': 'ROLE', + 'principalId': 'employee' + } + ]); aclService.load(); $httpBackend.flush(); })); diff --git a/front/core/lib/specs/acl-service.spec.js b/front/core/lib/specs/acl-service.spec.js index 3a1460241..53f84ac7e 100644 --- a/front/core/lib/specs/acl-service.spec.js +++ b/front/core/lib/specs/acl-service.spec.js @@ -11,6 +11,17 @@ describe('Service acl', () => { {role: {name: 'baz'}} ] }); + $httpBackend.whenPOST('Accounts/user/acl').respond([ + { + 'id': 1, + 'model': 'ModelExample', + 'property': '*', + 'accessType': '*', + 'permission': 'ALLOW', + 'principalType': 'ROLE', + 'principalId': 'employee' + } + ]); aclService = _aclService_; aclService.load(); $httpBackend.flush(); diff --git a/front/core/services/acl-service.js b/front/core/services/acl-service.js index 9c6d432c1..3ea328cb8 100644 --- a/front/core/services/acl-service.js +++ b/front/core/services/acl-service.js @@ -16,8 +16,10 @@ class AclService { this.roles = {}; this.rolesMap = {}; res.data.roles.forEach(role => { - if (role.role) + if (role.role) { this.rolesMap[role.role.name] = true; + this.roles[role.role.name] = true; + } }); this.acls = {};