mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Update backend/src/graphql/directive/isAuthorized.ts
Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
parent
fe38cec4ac
commit
e7b104c3b5
@ -38,6 +38,7 @@ const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||
const countServerUsers = await ServerUser.count({ email: user.email })
|
||||
context.role = countServerUsers > 0 ? ROLE_ADMIN : ROLE_USER
|
||||
} catch {
|
||||
// in case the database query fails (user deleted)
|
||||
throw new Error('401 Unauthorized')
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user