Skip to content

Commit

Permalink
fix(enforcer.ts): fix deleteUser and improve deleteRole description
Browse files Browse the repository at this point in the history
deleteUser now removes related grouping policies and normal policies related to user. Previously
just grouping policies were removed. Now deleteUser is more in line with deleteRole

fix #118
  • Loading branch information
Sefriol committed Feb 20, 2020
1 parent 454165e commit 1e6af16
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/enforcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,14 @@ export class Enforcer extends ManagementEnforcer {
* @return succeeds or not.
*/
public async deleteUser(user: string): Promise<boolean> {
return this.removeFilteredGroupingPolicy(0, user);
const res1 = await this.removeFilteredGroupingPolicy(0, user);
const res2 = await this.removeFilteredPolicy(0, user);
return res1 || res2;
}

/**
* deleteRole deletes a role.
* Returns false if the role does not exist (aka not affected).
*
* @param role the role.
* @return succeeds or not.
Expand Down

0 comments on commit 1e6af16

Please sign in to comment.