From 2d603a1467eca50263a0ad2eea427e59da88d263 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Wed, 9 Dec 2020 18:45:39 +0100 Subject: [PATCH] resolve groups + permissions ref #12 --- src/models/actions/CreateAuth.ts | 2 +- src/models/actions/RefreshAuth.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/actions/CreateAuth.ts b/src/models/actions/CreateAuth.ts index 2832e19..d36c17f 100644 --- a/src/models/actions/CreateAuth.ts +++ b/src/models/actions/CreateAuth.ts @@ -28,7 +28,7 @@ export class CreateAuth { if (!this.password) { throw new PasswordNeededError() } - const found_users = await getConnectionManager().get().getRepository(User).find({ where: [{ username: this.username }, { email: this.email }] }); + const found_users = await getConnectionManager().get().getRepository(User).find({ relations: ['groups', 'permissions'], where: [{ username: this.username }, { email: this.email }] }); if (found_users.length === 0) { throw new UserNotFoundError() } else { diff --git a/src/models/actions/RefreshAuth.ts b/src/models/actions/RefreshAuth.ts index 55c124f..77a2728 100644 --- a/src/models/actions/RefreshAuth.ts +++ b/src/models/actions/RefreshAuth.ts @@ -21,7 +21,7 @@ export class RefreshAuth { } catch (error) { throw new IllegalJWTError() } - const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] }); + const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] }, { relations: ['groups', 'permissions'] }); if (!found_user) { throw new UserNotFoundError() }