fix front test not working
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2023-01-27 12:53:27 +01:00
parent baa7aa45b2
commit 2e4e0b12ab
3 changed files with 25 additions and 1 deletions

View File

@ -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();
}));

View File

@ -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();

View File

@ -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 = {};