1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

fix: make hasPermission call handle api tokens (#1041)

This commit is contained in:
Christopher Kolstad 2021-10-19 11:34:56 +02:00 committed by GitHub
parent 26407cc02e
commit 1f37b0bf4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(
@ -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);
}