Skip to content

Commit

Permalink
acl: Publish role changes. (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Mar 15, 2018
1 parent 88e5254 commit 6414ebf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export class Acl {
aclUser.roles.push(...aclRoles);

await aclUser.save();

this.uw.publish('acl:allow', {
userID: aclUser.id,
roles: aclRoles.map(role => role.id),
});
}

async disallow(user, roleNames) {
Expand All @@ -113,6 +118,11 @@ export class Acl {
aclUser.roles = aclUser.roles.filter(role =>
aclRoles.every(remove => remove.id !== getRoleName(role)));
await aclUser.save();

this.uw.publish('acl:disallow', {
userID: aclUser.id,
roles: aclRoles.map(role => role.id),
});
}

async getAllPermissions(user) {
Expand Down

0 comments on commit 6414ebf

Please sign in to comment.