Skip to content

Commit

Permalink
fix(acl): fix should be cancel full when call set (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Jul 12, 2021
1 parent 18e6ed5 commit ceef83c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/acl/src/acl.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ describe('acl: service', () => {
expect(srv.can(USER)).toBe(false);
});

it('should be cancel full when call set', () => {
srv.setFull(true);
expect(srv.can(ADMIN)).toBe(true);
srv.set([USER]);
expect(srv.can(ADMIN)).toBe(false);
});

it(`#setFull() set [true]`, () => {
srv.setFull(true);
expect(srv.can(ADMIN)).toBe(true);
Expand Down
1 change: 1 addition & 0 deletions packages/acl/src/acl.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class ACLService {
* 设置当前用户角色或权限能力(会先清除所有)
*/
set(value: ACLType): void {
this.full = false;
this.abilities = [];
this.roles = [];
this.add(value);
Expand Down

0 comments on commit ceef83c

Please sign in to comment.