Skip to content

Commit

Permalink
fix: make hasPermission call handle api tokens (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kolstad committed Oct 19, 2021
1 parent 26407cc commit 1f37b0b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/services/access-service.ts
Expand Up @@ -87,7 +87,7 @@ export class AccessService {
);

try {
const userP = await this.store.getPermissionsForUser(user.id);
const userP = await this.getPermissionsForUser(user);

return userP
.filter(
Expand All @@ -111,7 +111,9 @@ export class AccessService {

async getPermissionsForUser(user: User): Promise<IUserPermission[]> {
if (user.isAPI) {
return [];
return user.permissions.map((p) => ({
permission: p,
}));
}
return this.store.getPermissionsForUser(user.id);
}
Expand Down

0 comments on commit 1f37b0b

Please sign in to comment.