1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01: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 { try {
const userP = await this.store.getPermissionsForUser(user.id); const userP = await this.getPermissionsForUser(user);
return userP return userP
.filter( .filter(
@ -111,7 +111,9 @@ export class AccessService {
async getPermissionsForUser(user: User): Promise<IUserPermission[]> { async getPermissionsForUser(user: User): Promise<IUserPermission[]> {
if (user.isAPI) { if (user.isAPI) {
return []; return user.permissions.map((p) => ({
permission: p,
}));
} }
return this.store.getPermissionsForUser(user.id); return this.store.getPermissionsForUser(user.id);
} }