From 47bf651ba3ba2009e409e2d9bf24f82f9493df9a Mon Sep 17 00:00:00 2001 From: clauspeterhuebner <86960882+clauspeterhuebner@users.noreply.github.com> Date: Wed, 12 Jul 2023 22:53:38 +0200 Subject: [PATCH] Update backend/src/graphql/directive/isAuthorized.ts good hint, many thx... Co-authored-by: Moriz Wahl --- backend/src/graphql/directive/isAuthorized.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/directive/isAuthorized.ts b/backend/src/graphql/directive/isAuthorized.ts index 733201776..04579a3f9 100644 --- a/backend/src/graphql/directive/isAuthorized.ts +++ b/backend/src/graphql/directive/isAuthorized.ts @@ -38,7 +38,7 @@ export const isAuthorized: AuthChecker = async ({ context }, rights) => }) context.user = user context.role = ROLE_USER - if (user.userRoles && user.userRoles.length > 0) { + if (user.userRoles?.length > 0) { switch (user.userRoles[0].role) { case ROLE_NAMES.ROLE_NAME_ADMIN: context.role = ROLE_ADMIN