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