resolve groups + permissions

ref #12
This commit is contained in:
Philipp Dormann 2020-12-09 18:45:39 +01:00
parent e4cb8eba1d
commit 2d603a1467
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

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