mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
include user contact in user context object
This commit is contained in:
parent
7b8d4e5c85
commit
b52c62749c
@ -31,7 +31,10 @@ const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||
// TODO - load from database dynamically & admin - maybe encode this in the token to prevent many database requests
|
||||
// TODO this implementation is bullshit - two database queries cause our user identifiers are not aligned and vary between email, id and pubKey
|
||||
try {
|
||||
const user = await User.findOneOrFail({ where: { gradidoID: decoded.gradidoID } })
|
||||
const user = await User.findOneOrFail({
|
||||
where: { gradidoID: decoded.gradidoID },
|
||||
relations: ['emailContact'],
|
||||
})
|
||||
context.user = user
|
||||
context.role = user.isAdmin ? ROLE_ADMIN : ROLE_USER
|
||||
} catch {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user