Skip to content

Commit

Permalink
acl: Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Dec 31, 2016
1 parent 96568a1 commit 80284dc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/plugins/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ export class Acl {
debug('existing roles', existingRoles);
if (existingRoles === 0) {
debug('no roles found, adding defaults');
for (const roleName of Object.keys(defaultRoles)) {
await this.createRole(roleName, defaultRoles[roleName]);
}
const promises = Object.keys(defaultRoles).map(roleName =>
this.createRole(roleName, defaultRoles[roleName])
);

await Promise.all(promises);
}
}

Expand Down Expand Up @@ -101,9 +103,9 @@ export class Acl {
async allow(user, roleNames) {
const aclRoles = await this.getAclRoles(roleNames);
const aclUser = await this.getAclUser(user);
for (const role of aclRoles) {
aclUser.roles.push(role);
}

aclUser.roles.push(...aclRoles);

await aclUser.save();
}

Expand Down Expand Up @@ -139,7 +141,7 @@ export class Acl {
}

export default function acl() {
return uw => {
return (uw) => {
uw.acl = new Acl(uw); // eslint-disable-line no-param-reassign
};
}

0 comments on commit 80284dc

Please sign in to comment.